Downloads containing cpd.j2as

Downloads
Name Author Game Mode Rating
TSF with JJ2+ Only: Anniversary Bash 20 Levels Jazz2Online Multiple N/A Download file
TSF with JJ2+ Only: Complete Pipe DreamFeatured Download FireSworD Capture the flag 9.1 Download file
TSF with JJ2+ Only: Complete Pipe DreamFeatured Download FireSworD Capture the flag 9.1 Download file

File preview

  1. #pragma require "SEfirework.asc"
  2. #include "SEfirework.asc"
  3. se::DefaultWeaponHook weaponHook;
  4. bool onDrawAmmo(jjPLAYER@ player, jjCANVAS@ canvas) {
  5.         return weaponHook.drawAmmo(player, canvas);
  6. }
  7. void onMain() {
  8.         weaponHook.processMain();
  9.         for (int i = 1; i < jjObjectCount; i++) {
  10.                 if ((jjObjects[i].eventID == OBJECT::FULLENERGY || jjObjects[i].eventID == OBJECT::COPTER || jjObjects[i].eventID == OBJECT::TOASTERPOWERUP || jjObjects[i].eventID == OBJECT::LIGHTNINGSHIELD) && (jjObjects[i].state == STATE::FLY || jjObjects[i].behavior == BEHAVIOR::MONITOR || jjObjects[i].eventID == OBJECT::LIGHTNINGSHIELD)) {
  11.                         jjObjects[i].xPos = jjObjects[i].xOrg - 16;
  12.                 }
  13.         }
  14. }
  15. void onPlayer(jjPLAYER@ player) {
  16.         weaponHook.processPlayer(player);
  17. }
  18. void onPlayerInput(jjPLAYER@ player) {
  19.         weaponHook.processPlayerInput(player);
  20. }
  21. void onReceive(jjSTREAM &in packet, int clientID) {
  22.         weaponHook.processPacket(packet, clientID);
  23. }
  24. void onLevelLoad() {
  25.         jjUseLayer8Speeds = true;
  26.         jjLayerXSpeed[8] = 0.1;
  27.         se::firework.loadAnims(jjAnimSets[ANIM::CUSTOM[1]]);
  28.         se::firework.loadSamples(array<SOUND::Sample> = {SOUND::INTRO_BOEM1, SOUND::INTRO_BOEM2});
  29.         se::firework.setAsWeapon(6, weaponHook);
  30.         for (int i = 1; i < 255; i++) {
  31.                 if (jjObjectPresets[i].playerHandling == HANDLING::PICKUP) {
  32.                         jjObjectPresets[i].behavior = CannotBeShotDown(jjObjectPresets[i].behavior);
  33.                 }
  34.         }
  35.         jjObjectPresets[OBJECT::LIGHTNINGSHIELD].behavior = Shield(SHIELD::LIGHTNING);
  36.         jjObjectPresets[OBJECT::LIGHTNINGSHIELD].scriptedCollisions = true;
  37. }
  38. class CannotBeShotDown : jjBEHAVIORINTERFACE {
  39.         jjBEHAVIOR originalBehavior;
  40.         CannotBeShotDown(jjBEHAVIOR behavior) {
  41.                 originalBehavior = behavior;
  42.         }
  43.         void onBehave(jjOBJ@ obj) override {
  44.                 obj.behave(originalBehavior);
  45.                 if (obj.state == STATE::FLOATFALL)
  46.                         obj.state = STATE::FLOAT;
  47.                 if (obj.eventID == OBJECT::FULLENERGY)
  48.                         obj.xPos = obj.xOrg - 16;
  49.         }
  50.         bool onObjectHit(jjOBJ@ obj, jjOBJ@ bullet, jjPLAYER@ player, int force) {
  51.                 obj.behavior = originalBehavior;
  52.                 if (bullet is null)
  53.                         player.objectHit(obj, force, obj.playerHandling);
  54.                 else
  55.                         bullet.objectHit(obj, obj.playerHandling);
  56.                 obj.behavior = CannotBeShotDown(obj.behavior);
  57.                 return true;
  58.         }
  59. }
  60. class Shield : jjBEHAVIORINTERFACE {
  61.         SHIELD::Shield shieldType;
  62.         Shield(SHIELD::Shield type) {
  63.                 shieldType = type;
  64.         }
  65.         void onBehave(jjOBJ@ obj) override {
  66.                 obj.behave(BEHAVIOR::MONITOR);
  67.         }
  68.         bool onObjectHit(jjOBJ@ obj, jjOBJ@ bullet, jjPLAYER@ player, int force) {
  69.                 const int timeWhenKicked = 20 * 70;
  70.                 const int timeWhenShot = 20 * 70;
  71.                 const int timeBonusForLosingTeam = 20 * 70;
  72.                 bool granted = false, burn = false;
  73.                 if (bullet is null) {
  74.                         if (force != 0) {
  75.                                 granted = true;
  76.                                 player.shieldTime = timeWhenKicked;
  77.                                 obj.particlePixelExplosion(2);
  78.                         }
  79.                 } else {
  80.                         if (player !is null) {
  81.                                 granted = true;
  82.                                 player.shieldTime = timeWhenShot;
  83.                                 burn = bullet.var[6] & 2 != 0;
  84.                                 obj.particlePixelExplosion(burn ? 1 : 0);
  85.                                 if (bullet.var[6] & 16 == 0)
  86.                                         bullet.state = STATE::EXPLODE;
  87.                         }
  88.                 }
  89.                 if (granted) {
  90.                         if (jjGameMode == GAME::CTF && jjTeamScore[player.team] < jjTeamScore[TEAM::Color(player.team ^ 1)]) {
  91.                                 player.shieldTime += timeBonusForLosingTeam;
  92.                                 player.showText("@@@@@20 seconds are added, because your team is behind in scores.");
  93.                         }
  94.                         player.shieldType = shieldType;
  95.                         player.currWeapon = WEAPON::BLASTER;
  96.                         obj.energy = 0;
  97.                         obj.state = STATE::KILL;
  98.                         jjSample(player.xPos, player.yPos, SOUND::COMMON_GLASS2);
  99.                         jjSample(obj.xPos, obj.yPos, SOUND::COMMON_SHIELD1);
  100.                         if (burn)
  101.                                 jjSample(obj.xPos, obj.yPos, SOUND::COMMON_BURN);
  102.                 }
  103.                 return true;
  104.         }
  105. }