Downloads containing VDom2.j2as

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

File preview

  1. const bool MLLESetupSuccessful = MLLE::Setup(array<MLLEWeaponApply@> = {null, null, null, null, ArcaneWeapons::FusionCannon::Weapon(), null, null, WeaponVMega::Voranj::Weapon(), null}); ///@MLLE-Generated
  2. #include "MLLE-Include-1.5w.asc" ///@MLLE-Generated
  3. #pragma require "vdom.j2t" ///@MLLE-Generated
  4. #pragma require "Labrat1.j2t" ///@MLLE-Generated
  5. #pragma require "VDom2.j2l" ///@MLLE-Generated
  6. #include "WeaponVMega8.asc" ///@MLLE-Generated
  7. #pragma require "WeaponVMega8.asc" ///@MLLE-Generated
  8. #include "ArcaneWeapon9.asc" ///@MLLE-Generated
  9. #pragma require "ArcaneWeapon9.asc" ///@MLLE-Generated
  10.  
  11. ///@saveandrunargs -dom -server
  12.  
  13.  
  14. array<int> ControlPointsX = {jjControlPoints[0].xTile}, ControlPointsY = {jjControlPoints[0].yTile};
  15.  
  16. uint LeftmostTile = jjLayerWidth[4], RightmostTile = 0, TopmostTile = jjLayerHeight[4], BottommostTile = 0;
  17. void onLevelLoad() {
  18.         uint LeftmostCP = jjLayerWidth[4], RightmostCP = 0, TopmostCP = jjLayerHeight[4], BottommostCP = 0;
  19.         for (uint x = 0; x < uint(jjLayerWidth[4]); ++x)
  20.                 for (uint y = 0; y < uint(jjLayerHeight[4]); ++y) {
  21.                         if (jjEventGet(x,y) == AREA::TEXT) {
  22.                                 if (jjParameterGet(x,y,-4,4) == 0) {
  23.                                         ControlPointsX.insertLast(x);
  24.                                         ControlPointsY.insertLast(y);
  25.                                 }
  26.                                 if (x < LeftmostCP) LeftmostCP = x;
  27.                                 if (x > RightmostCP) RightmostCP = x;
  28.                                 if (y < TopmostCP) TopmostCP = y;
  29.                                 if (y > BottommostCP) BottommostCP = y;
  30.                                 jjEventSet(x,y, 0);
  31.                         }
  32.                         else //?
  33.                         if (jjTileGet(4,x,y) != 0 || jjEventGet(x,y) != 0) {
  34.                                 if (x < LeftmostTile) LeftmostTile = x;
  35.                                 if (x > RightmostTile) RightmostTile = x;
  36.                                 if (y < TopmostTile) TopmostTile = y;
  37.                                 if (y > BottommostTile) BottommostTile = y;
  38.                         }
  39.                 }
  40.                
  41.         const uint LeftmostPossibleTile = LeftmostTile + ControlPointsX[0] - RightmostCP;
  42.         const uint RightmostPossibleTile = RightmostTile + ControlPointsX[0] - LeftmostCP;
  43.         const uint TopmostPossibleTile = TopmostTile + ControlPointsY[0] - BottommostCP;
  44.         const uint BottommostPossibleTile = BottommostTile + ControlPointsY[0] - TopmostCP;
  45.         //jjDebug("Current:  " + LeftmostTile + "," + RightmostTile + "   " + TopmostTile + "," + BottommostTile);
  46.         //jjDebug("Possible: " + LeftmostPossibleTile + "," + RightmostPossibleTile + "   " + TopmostPossibleTile + "," + BottommostPossibleTile);
  47.         jjGenerateSettableTileArea(4, LeftmostPossibleTile, TopmostPossibleTile, RightmostPossibleTile - LeftmostPossibleTile + 1, BottommostPossibleTile - TopmostPossibleTile + 1);
  48.        
  49.         for (int eventID = OBJECT::BOUNCERPOWERUP; eventID <= OBJECT::GUN8POWERUP; ++eventID)
  50.                 if (jjObjectPresets[eventID].behavior == BEHAVIOR::MONITOR)
  51.                         jjObjectPresets[eventID].behavior = NoFallMonitor;
  52.                        
  53.         jjObjectPresets[OBJECT::BLUESPRING].ySpeed -= 4.9;
  54.         jjANIMATION@ blueSpring = jjAnimations[jjObjectPresets[OBJECT::BLUESPRING].curAnim];
  55.         for (uint i = 0; i < blueSpring.frameCount; ++i) {
  56.                 jjANIMFRAME@ frame = jjAnimFrames[blueSpring + i];
  57.                 jjPIXELMAP image(frame);
  58.                 for (uint x = 0; x < image.width; ++x)
  59.                         for (uint y = 0; y < image.height; ++y)
  60.                                 if (image[x,y] & ~7 == 32)
  61.                                         image[x,y] += 40;
  62.                 image.save(frame);
  63.         }
  64.        
  65.         jjObjectPresets[OBJECT::FRUITPLATFORM].bulletHandling = HANDLING::IGNOREBULLET;
  66. }
  67.  
  68. TEAM::Color LastControlPointColor = TEAM::NEUTRAL;
  69. uint LastControlPointChoice = 0; //first is always the Real one
  70. void onMain() {
  71.         if ((jjIsServer || jjGameConnection == GAME::LOCAL) && jjControlPoints[0].controlTeam != LastControlPointColor) {
  72.                 LastControlPointColor = jjControlPoints[0].controlTeam;
  73.                
  74.                 uint newControlPointChoice;
  75.                 do {
  76.                         newControlPointChoice = jjRandom() % ControlPointsX.length;
  77.                 } while (newControlPointChoice == LastControlPointChoice);
  78.                
  79.                 MoveControlPoint(newControlPointChoice);
  80.                 SendCurrentControlPoint(0);
  81.         }
  82. }
  83.  
  84. void SendCurrentControlPoint(int toClientID) {
  85.         jjSTREAM packet;
  86.         packet.push(uint8(LastControlPointChoice));
  87.         jjSendPacket(packet, toClientID);
  88. }
  89. void MoveControlPoint(uint newControlPointChoice) {
  90. //jjAlert("" + newControlPointChoice + ",  " + LastControlPointChoice);
  91.         if (newControlPointChoice == LastControlPointChoice) return;
  92.        
  93.         const int xDiff = ControlPointsX[LastControlPointChoice] - ControlPointsX[newControlPointChoice];
  94.         const int yDiff = ControlPointsY[LastControlPointChoice] - ControlPointsY[newControlPointChoice];
  95.         const float xdf = xDiff * 32, ydf = yDiff * 32;
  96.        
  97.         const array<uint8> explosionColors = {32, 24, 16, 40};
  98.         if (jjControlPoints[0].controlTeam != TEAM::NEUTRAL)
  99.                 jjAddParticlePixelExplosion(jjControlPoints[0].xPos, jjControlPoints[0].yPos, jjObjectPresets[OBJECT::SUPERGEM].curFrame, jjControlPoints[0].direction, explosionColors[jjControlPoints[0].controlTeam]);
  100.        
  101.         {
  102.                 const int xSign = xDiff != 0 ? (xDiff / int(abs(xDiff))) : 1;
  103.                 const int ySign = yDiff != 0 ? (yDiff / int(abs(yDiff))) : 1;
  104.                 const uint xStart = xSign == -1 ? LeftmostTile : RightmostTile;
  105.                 const uint yStart = ySign == -1 ? TopmostTile  : BottommostTile;
  106.                 const uint xEnd = xSign == -1 ? (RightmostTile  + 1) : (LeftmostTile - 1);
  107.                 const uint yEnd = ySign == -1 ? (BottommostTile + 1) : (TopmostTile  - 1);
  108.                
  109.                 for (uint x = xStart; x != xEnd; x -= xSign)
  110.                         for (uint y = yStart; y != yEnd; y -= ySign) {
  111.                                 jjTileSet(4, x + xDiff, y + yDiff, jjTileGet(4,x,y));
  112.                                 jjTileSet(4,x,y, 0);
  113.                                 jjParameterSet(x + xDiff, y + yDiff, -12, 32, jjParameterGet(x, y, -12, 32));
  114.                                 jjParameterSet(x, y, -12, 32, 0);
  115.                         }
  116.         }
  117.        
  118.         LeftmostTile += xDiff;
  119.         RightmostTile += xDiff;
  120.         TopmostTile += yDiff;
  121.         BottommostTile += yDiff;
  122.                
  123.         for (uint i = 0; i < 32; ++i)
  124.                 jjPlayers[i].offsetPosition(int(xdf),int(ydf));
  125.         for (uint i = 0; i < 1024; ++i) {
  126.                 jjPARTICLE@ part = jjParticles[i];
  127.                 part.xPos += xdf;
  128.                 part.yPos += ydf;
  129.         }
  130.         for (uint i = jjObjectCount; --i != 0;) {
  131.                 jjOBJ@ obj = jjObjects[i];
  132.                 obj.xPos += xdf;
  133.                 obj.yPos += ydf;
  134.                 obj.xOrg += xdf;
  135.                 obj.yOrg += ydf;
  136.                 if (obj.behavior == BEHAVIOR::SPRING) {
  137.                         obj.var[3] = obj.var[3] + int(xdf * 65536);
  138.                         obj.var[4] = obj.var[4] + int(ydf * 65536);
  139.                 }
  140.         }
  141.         jjLayerXOffset[3] = jjLayerXOffset[3] - xdf;
  142.         jjLayerYOffset[3] = jjLayerYOffset[3] - ydf;
  143.         jjLayerXOffset[5] = jjLayerXOffset[5] - xdf;
  144.         jjLayerYOffset[5] = jjLayerYOffset[5] - ydf;
  145.        
  146.         LastControlPointChoice = newControlPointChoice;
  147.        
  148.         jjSamplePriority(SOUND::CATERPIL_RIDOE);
  149. }
  150.  
  151. void onReceive(jjSTREAM &in packet, int fromClientID) {
  152.         if (jjIsServer) {
  153.                 SendCurrentControlPoint(fromClientID);
  154.         } else {
  155.                 uint8 newControlPointChoice;
  156.                 packet.pop(newControlPointChoice);
  157.                 MoveControlPoint(newControlPointChoice);
  158.         }
  159. }
  160. void onLevelBegin() {
  161.         if (!jjIsServer && jjGameConnection != GAME::LOCAL)
  162.                 jjSendPacket(jjSTREAM());
  163.         if (jjGameCustom == GAME::DOM)
  164.                 jjLocalPlayers[0].showText("@@@@The control point moves@@whenever it gets captured!", STRING::MEDIUM);
  165. }
  166.  
  167. void NoFallMonitor(jjOBJ@ obj) {
  168.         obj.direction = SPRITE::FLIPV;
  169.         obj.behavior = BEHAVIOR::MONITOR;
  170.         obj.behave();
  171.         obj.direction = (jjRandom() & 1) == 1 ? SPRITE::FLIPV : SPRITE::FLIPHV;
  172. }
  173.  
  174. void onLevelReload() { MLLE::Palette.apply(); }
  175. bool onDrawAmmo(jjPLAYER@ player, jjCANVAS@ canvas) {
  176.         return MLLE::WeaponHook.drawAmmo(player, canvas);
  177. }
  178.  
  179. array<int> fastCustomSpringSpeeds(jjLocalPlayerCount, 0);
  180. void onPlayer(jjPLAYER@ play) {
  181.         if (play.ySpeed < -32.f) {
  182.                 fastCustomSpringSpeeds[play.localPlayerID] = int(ceil((play.ySpeed + 32.f) / -0.125f));
  183.         } else if (fastCustomSpringSpeeds[play.localPlayerID] != 0) {
  184.                 if (play.ySpeed < -31.f) {
  185.                                 fastCustomSpringSpeeds[play.localPlayerID]--;
  186.                                 play.ySpeed = -32.f;
  187.                 } else {
  188.                                 fastCustomSpringSpeeds[play.localPlayerID] = 0;
  189.                 }
  190.         }
  191. }