Downloads containing VDom3.j2as

Downloads
Name Author Game Mode Rating
JJ2+ Only: violetclm DOM Episodes I...Featured Download Violet CLM Custom / Concept 9 Download file

File preview

  1. #include "MLLE-Include-1.5w.asc" ///@MLLE-Generated
  2. #pragma require "vdom.j2t" ///@MLLE-Generated
  3. #pragma require "VDom3.j2l" ///@MLLE-Generated
  4. #include "ArcaneWeapon7.asc" ///@MLLE-Generated
  5. #pragma require "ArcaneWeapon7.asc" ///@MLLE-Generated
  6. #include "ArcaneWeapon4.asc" ///@MLLE-Generated
  7. #pragma require "ArcaneWeapon4.asc" ///@MLLE-Generated
  8. #include "BubbleGun.asc" ///@MLLE-Generated
  9. #pragma require "BubbleGun.asc" ///@MLLE-Generated
  10. const bool MLLESetupSuccessful = MLLE::Setup(array<MLLEWeaponApply@> = {null, BubbleGun::MyBubble(), null, ArcaneWeapons::MortarLauncher::Weapon(), null, null, ArcaneWeapons::LightningRod::Weapon(), null, null});
  11.  
  12. ///@SaveAndRunArgs -dom -server
  13.  
  14. bool onDrawAmmo(jjPLAYER@ player, jjCANVAS@ canvas) {
  15.         return MLLE::WeaponHook.drawAmmo(player, canvas);
  16. }
  17.  
  18. void onLevelReload() { MLLE::Palette.apply(); }
  19. void onLevelLoad() {
  20.         jjObjectPresets[OBJECT::APPLE].behavior = LetPlayerThroughIfGemIsRightColor;
  21.         jjObjectPresets[OBJECT::APPLE].playerHandling = HANDLING::PARTICLE;
  22.         jjObjectPresets[OBJECT::TNTAMMO3].scriptedCollisions = true;
  23.        
  24.         //jjObjectPresets[OBJECT::REDSPRING].xSpeed = 3; //hmm
  25.        
  26.         jjANIMATION@ sparks = jjAnimations[jjAnimSets[ANIM::AMMO] + 75];
  27.         for (uint i = 0; i < sparks.frameCount; ++i) {
  28.                 jjANIMFRAME@ frame = jjAnimFrames[sparks + i];
  29.                 jjPIXELMAP image(frame);
  30.                 for (uint x = 0; x < image.width; ++x)
  31.                         for (uint y = 0; y < image.height; ++y)
  32.                                 if (image[x,y] != 0)
  33.                                         image[x,y] += 8;
  34.                 image.save(frame);
  35.         }
  36.                        
  37.         jjObjectPresets[OBJECT::REDSPRING].ySpeed = -40;
  38.         jjANIMATION@ redSpring = jjAnimations[jjObjectPresets[OBJECT::REDSPRING].curAnim];
  39.         for (uint i = 0; i < redSpring.frameCount; ++i) {
  40.                 jjANIMFRAME@ frame = jjAnimFrames[redSpring + i];
  41.                 jjPIXELMAP image(frame);
  42.                 for (uint x = 0; x < image.width; ++x)
  43.                         for (uint y = 0; y < image.height; ++y)
  44.                                 if (image[x,y] & ~7 == 24)
  45.                                         image[x,y] += 48;
  46.                 image.save(frame);
  47.         }
  48.        
  49.         jjObjectPresets[OBJECT::BOUNCERPOWERUP].behavior = BEHAVIOR::FISH;
  50.        
  51.         jjObjectPresets[OBJECT::SILVERCOIN].behavior = function(o) {
  52.                 if (jjGameCustom == GAME::DOM) { o.behave(BEHAVIOR::PICKUP); o.playerHandling = HANDLING::PICKUP; }
  53.                 else o.playerHandling = HANDLING::PARTICLE;
  54.         };
  55. }
  56.  
  57. TEAM::Color LastControlPointColor = TEAM::NEUTRAL;
  58. void LetPlayerThroughIfGemIsRightColor(jjOBJ@ obj) {
  59.         for (int i = 0; i < jjLocalPlayerCount; ++i) {
  60.                 const jjPLAYER@ play = jjLocalPlayers[i];
  61.                 if (play.isInGame && play.yPos < obj.yPos) {
  62.                         jjTileSet(4, int(obj.xOrg) >> 5, int(obj.yOrg) >> 5, play.team == jjControlPoints[0].controlTeam ? 0 : 655);
  63.                         break;
  64.                 }
  65.         }
  66.        
  67.         //onMain:
  68.         if ((jjIsServer || jjGameConnection == GAME::LOCAL) && jjGameCustom == GAME::DOM && jjControlPoints[0].controlTeam != LastControlPointColor) {
  69.                 LastControlPointColor = jjControlPoints[0].controlTeam;
  70.                 CoinsNeeded += 1;
  71.                 SendUpdate(0);
  72.         }
  73. }
  74.  
  75. int CoinsNeeded = 3;
  76. bool VerticalArrowSignsFlipped = false;
  77. bool onDrawGameModeHUD(jjPLAYER@ player, jjCANVAS@ canvas) {
  78.         bool arrowsShouldBeFlipped = false;
  79.         if (jjGameCustom == GAME::DOM) {
  80.                 int yStart = 0;
  81.                 if (jjResolutionWidth > 400) {
  82.                         int activeTeams = 0;
  83.                         for (int i = 0; i < 4; ++i)
  84.                                 if (jjEnabledTeams[i])
  85.                                         activeTeams += 1;
  86.                         if (activeTeams > 2)
  87.                                 yStart = 60;
  88.                 }
  89.                
  90.                 const bool enough = player !is null && player.coins >= CoinsNeeded;
  91.                 canvas.drawSprite(142,yStart+17, ANIM::PICKUPS, enough ? 37 : 84, jjGameTicks >> 3);
  92.                 if (player !is null) {
  93.                         canvas.drawString(160, yStart+13, (enough ? "||||" : "|||||||") + player.coins + "/" + CoinsNeeded, STRING::MEDIUM);
  94.                         if (enough) {
  95.                                 if (jjControlPoints[0].controlTeam != player.team) {
  96.                                         canvas.drawString(0x8000, jjSubscreenHeight - 49, "FALL   DOWN", STRING::MEDIUM, STRING::SPIN);
  97.                                         arrowsShouldBeFlipped = true;
  98.                                 }
  99.                         } else {
  100.                                 canvas.drawString(140, yStart+36, "1||Need " + (CoinsNeeded - player.coins) + " more", STRING::SMALL, STRING::NORMAL,0, SPRITE::TRANSLUCENTPALSHIFT);
  101.                                 canvas.drawString(140, yStart+52, "1||to use pit", STRING::SMALL, STRING::NORMAL,0, SPRITE::TRANSLUCENTPALSHIFT);
  102.                         }
  103.                 } else
  104.                         canvas.drawString(160, yStart+13, "|||||||" + CoinsNeeded, STRING::MEDIUM);
  105.         }
  106.         if (arrowsShouldBeFlipped != VerticalArrowSignsFlipped) {
  107.                 VerticalArrowSignsFlipped = arrowsShouldBeFlipped;
  108.                 jjPIXELMAP(149 | TILE::VFLIPPED).save(149, true);
  109.                 jjPIXELMAP(129 | TILE::HFLIPPED).save(129, true);
  110.         }
  111.         return false;
  112. }
  113.  
  114. void SendUpdate(int toClientID) {
  115.         jjSTREAM packet;
  116.         packet.push(uint8(CoinsNeeded));
  117.         jjSendPacket(packet, toClientID);
  118. }
  119. void onLevelBegin() {
  120.         if (!jjIsServer && jjGameConnection != GAME::LOCAL)
  121.                 jjSendPacket(jjSTREAM());
  122.         //for (int weaponID = WEAPON::BLASTER; weaponID <= WEAPON::GUN9; ++weaponID)
  123.         //      jjWeapons[weaponID].allowedPowerup =
  124.         //              jjWeapons[weaponID].allowed;
  125.         if (jjGameCustom == GAME::DOM)
  126.                 jjLocalPlayers[0].showText("@@@@The pit has a coin warp@@to go to the control point.", STRING::MEDIUM);
  127. }
  128. void onReceive(jjSTREAM &in packet, int fromClientID) {
  129.         if (jjIsServer) {
  130.                 SendUpdate(fromClientID);
  131.         } else {
  132.                 uint8 newCoins;
  133.                 packet.pop(newCoins);
  134.                 CoinsNeeded = newCoins;
  135.         }
  136. }
  137. array<bool> WasInCoinWarpRow(jjLocalPlayerCount,false);
  138. array<int> fastCustomSpringSpeeds(jjLocalPlayerCount, 0);
  139. void onPlayer(jjPLAYER@ player) {
  140.         if (player.ySpeed < -32.f) {
  141.                 fastCustomSpringSpeeds[player.localPlayerID] = int(ceil((player.ySpeed + 32.f) / -0.125f));
  142.         } else if (fastCustomSpringSpeeds[player.localPlayerID] != 0) {
  143.                 if (player.ySpeed < -31.f) {
  144.                                 fastCustomSpringSpeeds[player.localPlayerID]--;
  145.                                 player.ySpeed = -32.f;
  146.                 } else {
  147.                                 fastCustomSpringSpeeds[player.localPlayerID] = 0;
  148.                 }
  149.         }
  150.        
  151.         const bool inCoinWarpRow = jjGameCustom == GAME::DOM && int(player.yPos) >> 5 == jjLayerHeight[4] - 5;
  152.         if (inCoinWarpRow && !WasInCoinWarpRow[player.localPlayerID]) {
  153.                 if (player.testForCoins(CoinsNeeded)) {
  154.                         player.warpToID(0);
  155.                         //for (int weaponID = WEAPON::BLASTER; weaponID <= WEAPON::GUN9; ++weaponID)
  156.                         //      player.powerup[weaponID] = player.ammo[weaponID] != 0;
  157.                        
  158.                 }
  159.         }
  160.         WasInCoinWarpRow[player.localPlayerID] = inCoinWarpRow;
  161. }
  162.  
  163.  
  164. namespace BubbleGun {
  165.         class MyBubble : Weapon {
  166.                 void onBehave(jjOBJ@ obj) override {
  167.                         Weapon::onBehave(obj);
  168.                         obj.behavior = NoBounce;
  169.                 }
  170.         }
  171.         void NoBounce(jjOBJ@ obj) {
  172.                 const bool right = obj.xSpeed >= 0;
  173.                 obj.behave(Behavior);
  174.                 if (right != (obj.xSpeed >= 0))
  175.                         obj.var[7] = -obj.var[7];
  176.         }
  177. }
  178.