Downloads containing weaponMega5.mut

Downloads
Name Author Game Mode Rating
JJ2+ Only: Weapon MegaFeatured Download Violet CLM Mutator 8.7 Download file

File preview

  1. #pragma name "Weapon Mega: Backfire"
  2. #pragma require "weaponMega5.mut"
  3. #include "weaponMega.asc"
  4.  
  5. bool LoadWeaponMega5() {
  6.         if (!SafeToReplaceWeapon(WEAPON::RF))
  7.                 return false;
  8.                
  9.         jjWeapons[WEAPON::RF].defaultSample = false;
  10.         //jjWeapons[WEAPON::RF].spread = SPREAD::NORMAL;
  11.         jjWeapons[WEAPON::RF].style = WEAPON::NORMAL;
  12.         jjWeapons[WEAPON::RF].replacedByBubbles = true;
  13.        
  14.         Preset1.behavior = Backfire;
  15.         Preset2.behavior = Backfire;
  16.         Preset2.special = Preset2.curAnim = Preset1.special = Preset1.determineCurAnim(AnimSet, 0);
  17.         Preset1.determineCurFrame(); Preset2.determineCurFrame();
  18.         Preset1.xAcc /= 3; Preset1.xSpeed *= 4;
  19.         Preset2.xSpeed *= 3;
  20.         Preset1.killAnim = Preset2.killAnim = Preset1.curAnim + 1;
  21.        
  22.         return true;
  23. }
  24. const bool WeaponMega5Loaded = LoadWeaponMega5();
  25.  
  26. void Backfire(jjOBJ@ obj) {
  27.         if (obj.state == STATE::START) {
  28.                 if (obj.creatorType == CREATOR::PLAYER) {
  29.                         jjAddObject(obj.eventID, obj.xPos, obj.yPos, obj.objectID, CREATOR::OBJECT);
  30.                         jjSample(obj.xPos, obj.yPos, SOUND::COMMON_PISTOL1);
  31.                 } else {
  32.                         const jjOBJ@ creator = jjObjects[obj.creatorID];
  33.                         if (creator.eventID == obj.eventID) {
  34.                                 obj.xSpeed = -creator.xSpeed;
  35.                                 obj.ySpeed = -creator.ySpeed;
  36.                                 obj.xAcc = -creator.xAcc;
  37.                                 obj.yAcc = -creator.yAcc;
  38.                                 obj.var[7] = -creator.var[7];
  39.                                 obj.counterEnd = creator.counterEnd;
  40.                                 obj.creator = creator.creator;
  41.                         }
  42.                 }
  43.         }
  44.        
  45.         const bool dying = obj.state == STATE::EXPLODE;
  46.         obj.behave(BEHAVIOR::BULLET, dying);
  47.        
  48.         const float speedAdjustment = /*((obj.var[6] & 8) == 0) ? 1.04f :*/ 0.95f;
  49.         if (abs(obj.xSpeed) > abs(obj.ySpeed))
  50.                 obj.ySpeed *= speedAdjustment;
  51.         else
  52.                 obj.xSpeed *= speedAdjustment;
  53.                
  54.         if (!dying)
  55.                 jjDrawRotatedSpriteFromCurFrame(obj.xPos, obj.yPos, obj.curFrame, int(atan2(
  56.                                 (obj.xSpeed >= 0) ? obj.ySpeed : -obj.ySpeed,
  57.                                 abs(obj.xSpeed)
  58.                 ) * -512.0 * 0.318309886142228), obj.direction = int((obj.xSpeed >= 0) ? 1 : -1), 1, SPRITE::SINGLEHUE, ((obj.var[6] & 8) == 0) ? 40 : 32);
  59. }