Downloads containing jjnetAmmo_retroic.asc

Downloads
Name Author Game Mode Rating
TSF with JJ2+ Only: Retroic FireSworD Battle N/A Download file
TSF with JJ2+ Only: Anniversary Bash 24 Battle PurpleJazz Battle N/A Download file

File preview

  1. /*Information about the weapons and objects*/
  2. const array<int> nonPUs = {0, 0, 24, 30, 33, 48, 56, 0, 0, 0, 0, 0, 0, 0};      //[1] = blaster, [2] = bnc , ...
  3. const array<int> PUs    = {0, 0, 25, 29, 34, 49, 57, 0, 0, 0, 0, 0, 0, 0};      //idem
  4.  
  5. int objectToWeapon(int eventID) {
  6.         int weaponID = 0;
  7.         switch(eventID) {
  8.                 case OBJECT::BOUNCERAMMO15      :       weaponID = WEAPON::BOUNCER;     break;
  9.                 case OBJECT::ICEAMMO15          :       weaponID = WEAPON::ICE;                 break;
  10.                 case OBJECT::SEEKERAMMO15       :       weaponID = WEAPON::SEEKER;              break;
  11.                 case OBJECT::RFAMMO15           :       weaponID = WEAPON::RF;                  break;
  12.                 case OBJECT::TOASTERAMMO15      :       weaponID = WEAPON::TOASTER;     break;
  13.         }
  14.         return weaponID;
  15. }
  16.  
  17. /*The rest!*/
  18. void setOnlyBncFromGunCrates () {
  19.         for (uint j=0; j < 10;j++) {
  20.                 if (j != WEAPON::BOUNCER) jjWeapons[j].comesFromGunCrates = false;
  21.         }
  22. }
  23.  
  24. void setAmmoPresets(int Object) {
  25.         jjObjectPresets[Object].scriptedCollisions = true;
  26.         jjObjectPresets[Object].behavior = ammoBehaviour;
  27.         jjObjectPresets[Object].determineCurFrame();
  28.         jjObjectPresets[Object].state = STATE::FLOATFALL;
  29.         jjObjectPresets[Object].bulletHandling = HANDLING::IGNOREBULLET;
  30.         jjObjectPresets[Object].playerHandling = HANDLING::SPECIAL;
  31. }
  32.  
  33. void ammoBehaviour(jjOBJ@ obj) {
  34.         int ammoType = objectToWeapon(obj.eventID);
  35.         obj.behave(BEHAVIOR::PICKUP, false);
  36.         obj.xPos = obj.xOrg;
  37.         obj.yPos = obj.yOrg;
  38.         if (obj.justHit == 0) {
  39.                 jjDrawResizedSprite(obj.xPos, obj.yPos, ANIM::AMMO,
  40.                         jjLocalPlayers[0].powerup[ammoType] == true? nonPUs[ammoType]:PUs[ammoType],
  41.                         jjGameTicks >> 2, 2, 2, SPRITE::NORMAL);
  42.         }
  43. }
  44.  
  45. void onObjectHit(jjOBJ@ obj, jjOBJ@ bullet, jjPLAYER@ play, int force) {
  46.         int ammoType = objectToWeapon(obj.eventID);
  47.         if (ammoType>0 && play.isLocal) {
  48.                 if (play.ammo[ammoType] == 0 && jjAutoWeaponChange) play.currWeapon = ammoType;
  49.                 if (play.ammo[ammoType] < 30) {
  50.                         play.ammo[ammoType] = 30;
  51.                         jjSample(obj.xPos, obj.yPos, SOUND::COMMON_PICKUPW1);
  52.                 }
  53.         }
  54. }