Advertisement
ijontichy

hatstuff.c

Apr 10th, 2014
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 3.77 KB | None | 0 0
  1. #include "zcommon.acs"
  2. #library "hatstuff"
  3.  
  4. #include "commonFuncs.h"
  5.  
  6. int CL_ShipTIDs[PLAYERMAX];     // BUTT SHIP TIDS SON
  7. int CL_ShipScripts[PLAYERMAX];  // WE TWERKING THE SEVEN SEAS YET
  8. int CL_PlayerTIDS[PLAYERMAX];   // duh
  9.  
  10. script 173 enter
  11. {
  12.     int pln = PlayerNumber();
  13.     int tid;
  14.     int time = 0;
  15.  
  16.     while (1)
  17.     {
  18.         if (!isDead(0)) { tid = defaultTID(-1); }
  19.  
  20.         if (time % 18 == 0)
  21.         {
  22.             ACS_ExecuteAlways(174, 0, 0, tid);
  23.             time %= 18;
  24.         }
  25.  
  26.         time++;
  27.         Delay(1);
  28.     }
  29. }
  30.  
  31. script 174 (int which, int a1, int a2) clientside
  32. {
  33.     int pln = PlayerNumber();
  34.     int testtid = unusedTID(38000, 48000);
  35.  
  36.     switch (which)
  37.     {
  38.       case 0:
  39.         CL_PlayerTIDs[pln] = a1;
  40.         Thing_ChangeTID(0, a1);
  41.  
  42.         // GET THAT BUTT SHIP ROLLING
  43.         ACS_ExecuteWithResult(175, pln, 0);
  44.         break;
  45.     }
  46. }
  47.  
  48. script 175 (int pln, int nocountdeath) clientside
  49. {
  50.     if (CL_ShipScripts[pln]) { terminate; }
  51.     CL_ShipScripts[pln] = 1;
  52.  
  53.     SetActivator(-1);
  54.     int shipTID = -1;
  55.     int mytid;
  56.     int i, x, y, z, a, vx, vy, vz;
  57.     int reloop;
  58.     int nx, ny, nz;
  59.     int height;
  60.  
  61.     while (PlayerInGame(pln))
  62.     {
  63.         mytid = CL_PlayerTIDs[pln];
  64.  
  65.         if (isDead(mytid) && Timer() >= nocountdeath)
  66.         {
  67.             // BUTT SHIP'S DOWN, WHAT THE HELL NIGGA
  68.         }
  69.        
  70.         x = GetActorX(mytid);
  71.         y = GetActorY(mytid);
  72.         z = GetActorZ(mytid);
  73.         a = GetActorAngle(mytid);
  74.         vx = GetActorVelX(mytid);
  75.         vy = GetActorVelY(mytid);
  76.         vz = GetActorVelZ(mytid);
  77.  
  78.         // WE GOT NO BUTT SHIP, WE GOTTA FIX THAT SHIT
  79.         if (ThingCount(0, shipTID) <= 0)
  80.         {
  81.             if (ThingCount(0, shipTID) > 0 && shipTID != 0) { Thing_Remove(shipTID); }
  82.  
  83.             shipTID = unusedTID(12000, 15000);
  84.             while (1)
  85.             {
  86.                 reloop = 0;
  87.  
  88.                 // NIGGA WE CAN'T BE CONFUSING BUTT SHIPS
  89.                 for (i = 0; i < PLAYERMAX; i++)
  90.                 {
  91.                     if (CL_PlayerTIDs[i] == shipTID || CL_ShipTIDs[i] == shipTID || ThingCount(0, shipTID) > 0)
  92.                     {
  93.                         shipTID++;
  94.                         reloop = 1;
  95.                         break;
  96.                     }
  97.                 }
  98.                
  99.                 if (!reloop) { break; }
  100.             }
  101.  
  102.             // TOOT TOOT THE BUTT SHIP HAS ARRIVED
  103.             Spawn("NIGPLZ", x,y,z, shipTID, a);
  104.         }
  105.  
  106.         // YOUR COLORS ARE NEAT, AND THE BUTT SHIP'S STEALIN' EM
  107.         if (1)
  108.         {
  109.             SetActivator(mytid);
  110.             Thing_SetTranslation(shipTID, -1);
  111.             SetActivator(-1);
  112.         }
  113.  
  114.         CL_ShipTIDs[pln] = shipTID;
  115.  
  116.         // THE BUTT SHIP IS STEALTHY
  117.         SetActorProperty(shipTID, APROP_Alpha, GetActorProperty(mytid, APROP_Alpha));
  118.  
  119.         // MOVE THAT BUTT SHIP AROUND WOOP WOOP
  120.         // (angle's factored in; pitch isn't)
  121.         int xOffset = 0, yOffset = 0, zOffset = 0;
  122.  
  123.         nx = x + FixedMul(xOffset, cos(a)) + FixedMul(yOffset, sin(a));
  124.         ny = y + FixedMul(xOffset, sin(a)) - FixedMul(yOffset, cos(a));
  125.         nz = z + zOffset;
  126.  
  127.         if (pln != ConsolePlayerNumber())
  128.         {
  129.             // HOLD ON BACK THAT BUTT SHIP UP
  130.             nx -= vx; ny -= vy; nz -= vz;
  131.         }
  132.         else
  133.         {
  134.             // NOT FAR ENOUGH, KEEP BACKIN IT UP
  135.             // (players have weird camera interpolation re. Z movement)
  136.             nx -= vx; ny -= vy; nz -= 2*vz;
  137.         }
  138.  
  139.         SetActorAngle(shipTID, a);
  140.         SetActorPosition(shipTID, nx, ny, nz, 0);
  141.         SetActorVelocity(shipTID, vx, vy, vz, 0, 0);
  142.        
  143.         Delay(1);
  144.     }
  145.  
  146.     CL_ShipScripts[pln] = 0;
  147. }
  148.  
  149. script 176 (int pln) disconnect clientside
  150. {
  151.     Thing_Remove(CL_ShipTIDs[pln]);
  152.     CL_PlayerTIDs[pln] = 0;
  153.     CL_ShipTIDs[pln] = 0;
  154. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement