Advertisement
ijontichy

parkmore.c

Apr 6th, 2013
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 36.97 KB | None | 0 0
  1. #include "zcommon.acs"
  2. #library "parkmore"
  3.  
  4. #include "commonFuncs.h"
  5. #include "parkConst.h"
  6.  
  7. world int 0:MaxJumpCount;
  8.  
  9. int playerJumps[PLAYERMAX] = {0};
  10. int hasKicked[PLAYERMAX]   = {0};
  11. int grabbing[PLAYERMAX]    = {0};
  12. int dontGrab[PLAYERMAX]    = {0};
  13.  
  14. int CPlayerGrounds[PLAYERMAX][2];
  15. int PlayerGrounds[PLAYERMAX][2];
  16. int DidSpecials[PLAYERMAX];
  17. int playerTimers[PLAYERMAX][TIMER_COUNT];
  18. int ClientEnterLocks[PLAYERMAX];
  19. int IsServer;
  20.  
  21. /* Comment markers:
  22.  *  :TURNING    - Turning scripts
  23.  *  :MOVEMENT   - Wall-jumping, dodging scripts
  24.  *  :DAEMONS    - The scripts that loop
  25.  *  :USER       - The customisable crap
  26.  *  :ASSORTED   - Where everything else goes
  27.  */
  28.  
  29. function int parkmoreOnGround(int tid)
  30. {
  31.     int ctid = unusedTID(13000, 18000);
  32.     int spawned = Spawn("ParkmoreFloorChecker", GetActorX(tid), GetActorY(tid), GetActorZ(tid)-4.0, ctid);
  33.     if (spawned) { Thing_Remove(ctid); }
  34.  
  35.     return (onGround(tid) ||
  36.         (GetActorVelZ(tid) == 0 && !spawned));
  37. }
  38.  
  39.  
  40. /*  :TURNING
  41.  * Turning scripts
  42.  */
  43.  
  44. script PARKMORE_TURN (int degrees, int factor, int direction) net clientside
  45. {
  46.     if (degrees < 0)
  47.     {
  48.         degrees *= -1;
  49.         direction = cond(direction == CLOCKWISE, COUNTERCLOCKWISE, CLOCKWISE);
  50.     }
  51.    
  52.     factor = cond(factor, factor, 4);
  53.  
  54.     int prevDegrees, addDegrees, curAngle;
  55.     int curDegrees = 0;
  56.     int floatDegrees = itof(degrees);
  57.     int dirMult = cond(direction == CLOCKWISE, -1, 1);
  58.  
  59.     while (curDegrees < (floatDegrees - 0.1))
  60.     {
  61.         prevDegrees = curDegrees;
  62.         addDegrees = (floatDegrees - curDegrees) / factor;
  63.         curDegrees += addDegrees;
  64.  
  65.         //Log(f:floatDegrees, s:", ", f:curDegrees, s:", +", f:addDegrees);
  66.  
  67.         SetActorAngle(0, GetActorAngle(0) + ((addDegrees * dirMult) / 360));
  68.         Delay(1);
  69.     }
  70.  
  71.     addDegrees = floatDegrees - curDegrees;
  72.     SetActorAngle(0, GetActorAngle(0) + ((addDegrees * dirMult) / 360));
  73. }
  74.  
  75. script PARKMORE_PITCH (int degrees, int factor, int direction) net clientside
  76. {
  77.     if (degrees < 0)
  78.     {
  79.         degrees *= -1;
  80.         direction = cond(direction == CLOCKWISE, COUNTERCLOCKWISE, CLOCKWISE);
  81.     }
  82.    
  83.     factor = cond(factor, factor, 4);
  84.  
  85.     int prevDegrees, addDegrees, curAngle;
  86.     int curDegrees = 0;
  87.     int floatDegrees = itof(degrees);
  88.     int dirMult = cond(direction == PITCH_UP, -1, 1);
  89.  
  90.     while (curDegrees < (floatDegrees - 0.1))
  91.     {
  92.         prevDegrees = curDegrees;
  93.         addDegrees = (floatDegrees - curDegrees) / factor;
  94.         curDegrees += addDegrees;
  95.  
  96.         SetActorPitch(0, GetActorPitch(0) + ((addDegrees * dirMult) / 360));
  97.         Delay(1);
  98.     }
  99.  
  100.     addDegrees = floatDegrees - curDegrees;
  101.     SetActorPitch(0, GetActorPitch(0) + ((addDegrees * dirMult) / 360));
  102. }
  103.  
  104.  
  105. script PARKMORE_SETTURN (int angle, int factor) net clientside
  106. {
  107.     int newAngle = mod(ftoi(GetActorAngle(0) * 360) - angle, 360);
  108.     int direction = CLOCKWISE;
  109.  
  110.     if (newAngle > 180)
  111.     {
  112.         direction = COUNTERCLOCKWISE;
  113.         newAngle = 360 - newAngle;
  114.     }
  115.  
  116.     ACS_ExecuteAlways(PARKMORE_TURN, 0, newAngle, factor, direction);
  117. }
  118.  
  119. script PARKMORE_SETPITCH (int pitch, int factor) net
  120. {
  121.     int newPitch = mod(ftoi(-GetActorPitch(0) * 360) - pitch, 360);
  122.     int direction = PITCH_UP;
  123.  
  124.     if (newPitch > 180)
  125.     {
  126.         direction = PITCH_DOWN;
  127.         newPitch = 360 - newPitch;
  128.     }
  129.  
  130.     ACS_ExecuteAlways(PARKMORE_PITCH, 0, -newPitch, factor, direction);
  131. }
  132.  
  133. /*  :MOVEMENT
  134.  * Wall-jumping, dodging scripts
  135.  */
  136.  
  137. function int hasHighJump(void)
  138. {
  139.     return CheckInventory("RuneHighJump") || CheckInventory("PowerHighJump")
  140.             || CheckInventory("CyberBoostJump");
  141. }
  142.  
  143. function int getJumpZ(void)
  144. {
  145.     int ret = GetActorProperty(0, APROP_JumpZ);
  146.  
  147.     ret *= (hasHighJump() + 1);
  148.    
  149.     return ret;
  150. }
  151.  
  152. function void wallBounce (int type, int direction)
  153. {
  154.     int forwardMult, sideMult, xyMult, zMult;
  155.     int forward, side, up;
  156.     int forwardx, forwardy, sidex, sidey;
  157.     int velx, vely, velz;
  158.  
  159.     int pln = PlayerNumber();
  160.     int angle = GetActorAngle(0);
  161.  
  162.     if (type == WB_KICKUP && hasKicked[pln]) { return; }
  163.  
  164.     switch (type)
  165.     {
  166.         case WB_DODGE:  xyMult =  1.0;  zMult = 0.5; break;
  167.         case WB_KICK:   xyMult =  0.8;  zMult = 1.0; break;
  168.         case WB_KICKUP: xyMult =  0.02; zMult = 1.3; break;
  169.         default: return;
  170.     }
  171.  
  172.     xyMult = FixedMul(xyMult, GetActorProperty(0, APROP_Speed));
  173.     zMult  = FixedMul(zMult,  GetActorProperty(0, APROP_JumpZ));
  174.  
  175.     if (hasHighJump())
  176.     {
  177.         xyMult = FixedMul(xyMult, 1.4142);
  178.         zMult  = FixedMul(zMult, 1.4142);
  179.     }
  180.  
  181.     if (CheckInventory("CyberBoostSpeed")) { xyMult = FixedMul(1.4142, xyMult); }
  182.     if (CheckInventory("CyberBoostJump"))  { zMult  = FixedMul(1.4142, zMult); }
  183.  
  184.     switch (direction)
  185.     {
  186.         case WD_FORWARD:  forwardMult =  1.0;   sideMult =  0.0;    break;
  187.         case WD_FORWRITE: forwardMult =  0.707; sideMult =  0.707;  break;
  188.         case WD_RIGHT:    forwardMult =  0.0;   sideMult =  1.0;    break;
  189.         case WD_BACKRITE: forwardMult = -0.707; sideMult =  0.707;  break;
  190.         case WD_BACK:     forwardMult = -1.0;   sideMult =  0.0;    break;
  191.         case WD_BACKLEFT: forwardMult = -0.707; sideMult = -0.707;  break;
  192.         case WD_LEFT:     forwardMult =  0.0;   sideMult = -1.0;    break;
  193.         case WD_FORWLEFT: forwardMult =  0.707; sideMult = -0.707;  break;
  194.         case WD_KICK:     forwardMult = -1.0;   sideMult =  0.0;    break;
  195.         default: return;
  196.     }
  197.    
  198.     forward = FixedMul(WB_XYBASE, forwardMult);
  199.     side    = FixedMul(WB_XYBASE, sideMult);
  200.  
  201.     up      = FixedMul(WB_ZBASE, zMult);
  202.  
  203.     forwardx = FixedMul(cos(angle), forward);
  204.     forwardy = FixedMul(sin(angle), forward);
  205.     sidex = FixedMul(cos(angle-0.25), side);
  206.     sidey = FixedMul(sin(angle-0.25), side);
  207.    
  208.     velx = FixedMul(forwardx + sidex, xyMult);
  209.     vely = FixedMul(forwardy + sidey, xyMult);
  210.     velz = up;
  211.  
  212.     switch (type)
  213.     {
  214.         case WB_KICK:   SetActorVelocity(0, velx, vely, velz, 0, 1); break;
  215.         case WB_DODGE:
  216.          if (parkmoreOnGround(0))
  217.          {
  218.              SetActorVelocity(0, velx + (GetActorVelX(0)/3), vely + (GetActorVelY(0)/3), velz, 0, 1); break;
  219.          }
  220.          else
  221.          {
  222.              SetActorVelocity(0, velx + (GetActorVelX(0)/2), vely + (GetActorVelY(0)/2), velz, 0, 1); break;
  223.          }
  224.         case WB_KICKUP: SetActorVelocity(0, velx + GetActorVelX(0), GetActorVelY(0), velz, 0, 1); break;
  225.     }
  226.  
  227.     playerJumps[pln] = min(playerJumps[pln]+1, 1);
  228.  
  229.     if (type == WB_KICK)
  230.     {
  231.         switch (direction)
  232.         {
  233.             case WD_FORWRITE: ACS_ExecuteAlways(PARKMORE_TURN, 0, 45,  2, CLOCKWISE); break;
  234.             case WD_RIGHT:    ACS_ExecuteAlways(PARKMORE_TURN, 0, 90,  2, CLOCKWISE); break;
  235.             case WD_BACKRITE: ACS_ExecuteAlways(PARKMORE_TURN, 0, 135, 2, CLOCKWISE); break;
  236.             case WD_BACK:     ACS_ExecuteAlways(PARKMORE_TURN, 0, 180, 2, CLOCKWISE); break;
  237.             case WD_BACKLEFT: ACS_ExecuteAlways(PARKMORE_TURN, 0, 135, 2, COUNTERCLOCKWISE); break;
  238.             case WD_LEFT:     ACS_ExecuteAlways(PARKMORE_TURN, 0, 90,  2, COUNTERCLOCKWISE); break;
  239.             case WD_FORWLEFT: ACS_ExecuteAlways(PARKMORE_TURN, 0, 45,  2, COUNTERCLOCKWISE); break;
  240.         }
  241.     }
  242.  
  243.     if (type == WB_KICKUP) { hasKicked[pln] = 1; }
  244.     else { hasKicked[pln] = 0; }
  245.  
  246.     grabbing[pln] = 0;
  247.     dontGrab[pln] = 0;
  248.  
  249.     switch (type)
  250.     {
  251.         case WB_KICK: ActivatorSound("parkmore/walljump", 127); break;
  252.         case WB_DODGE: ActivatorSound("parkmore/dodge", 127); break;
  253.         case WB_KICKUP: ActivatorSound("parkmore/wajumpup", 127); break;
  254.     }
  255.  
  256.     GiveInventory("KickTrail", 1);
  257. }
  258.  
  259.  
  260. script PARKMORE_WALLBOUNCE (int type, int direction, int mask)
  261. {
  262.     int newDir = -1;
  263.     int justCheck;
  264.     int angle, x,y, x2,y2, i, j;
  265.     int tid, canBounce;
  266.     int sideMove, forwMove;
  267.     int x3,y3;
  268.  
  269.     if (isDead(0)) { terminate; }
  270.  
  271.     if (direction < 0) { direction = -direction; justCheck = 1; }
  272.  
  273.     if (type == WB_DODGE)
  274.     {
  275.         sideMove = keyDown(BT_MOVERIGHT) - keyDown(BT_MOVELEFT);
  276.         forwMove = keyDown(BT_FORWARD) - keyDown(BT_BACK);
  277.  
  278.         switch (direction)
  279.         {
  280.           case WD_FORWARD:
  281.             switch (sideMove)
  282.             {
  283.                 case -1: newDir = WD_FORWLEFT; break;
  284.                 case  0: break;
  285.                 case  1: newDir = WD_FORWRITE; break;
  286.             }
  287.             break;
  288.            
  289.           case WD_BACK:
  290.             switch (sideMove)
  291.             {
  292.                 case -1: newDir = WD_BACKLEFT; break;
  293.                 case  0: break;
  294.                 case  1: newDir = WD_BACKRITE; break;
  295.             }
  296.             break;
  297.            
  298.           case WD_LEFT:
  299.             switch (forwMove)
  300.             {
  301.                 case -1: newDir = WD_BACKLEFT; break;
  302.                 case  0: break;
  303.                 case  1: newDir = WD_FORWLEFT; break;
  304.             }
  305.             break;
  306.            
  307.           case WD_RIGHT:
  308.             switch (forwMove)
  309.             {
  310.                 case -1: newDir = WD_BACKRITE; break;
  311.                 case  0: break;
  312.                 case  1: newDir = WD_FORWRITE; break;
  313.             }
  314.             break;
  315.         }
  316.  
  317.         if (newDir != -1) { direction = newDir; }
  318.     }
  319.  
  320.     if (parkmoreOnGround(0))
  321.     {
  322.         if (type == WB_DODGE) { wallBounce(type, direction); }
  323.         terminate;
  324.     }
  325.  
  326.     if (mask == 0) { mask = 1; }
  327.  
  328.     angle = GetActorAngle(0) + AngleOffsets[direction];
  329.     angle = mod(angle, 1.0);
  330.  
  331.     x  = 20 * cos(angle); y  = 20 * sin(angle);
  332.     x2 = 8  * cos(angle); y2 = 8  * sin(angle);
  333.  
  334.     if (abs(x) > abs(y))
  335.     {
  336.         y = FixedMul(y, FixedDiv(20.0, abs(x)));
  337.         x = 20.0 * sign(x);
  338.     }
  339.     else
  340.     {
  341.         x = FixedMul(x, FixedDiv(20.0, abs(y)));
  342.         y = 20.0 * sign(y);
  343.     }
  344.  
  345.     canBounce = 0;
  346.     for (i = 0; i < 10; i++)
  347.     {
  348.         tid = unusedTID(25000, 30000);
  349.         x3 = GetActorX(0) + x + (x2*i);
  350.         y3 = GetActorY(0) + y + (y2*i);
  351.  
  352.         j = Spawn("ParkmoreChecker2", GetActorX(0) + x + (x2*i),
  353.                     GetActorY(0) + y + (y2*i), GetActorZ(0) + 16.0, tid);
  354.         Thing_Remove(tid);
  355.         //PrintBold(s:"(", f:x3, s:", ", f:y3, s:") type ", d:type, s:" - ", d:j);
  356.        
  357.         if (!j) { canBounce = 1; break; }
  358.     }
  359.    
  360.     if (canBounce && !justCheck)
  361.     {
  362.         wallBounce(type, direction);
  363.     }
  364.  
  365.     //Print(s:"wallbounce (func): ", d:canBounce, s:" - angle is ", f:angle, s:", direction is ", d:direction, s:" (", f:x, s:", ", f:y, s:")");
  366.     SetResultValue(canBounce);
  367. }
  368.  
  369.  
  370. script PARKMORE_LEDGEWALL (int mode)
  371. {
  372.     int pln = PlayerNumber();
  373.     int curX, curY, curZ, curAngle, newZ;
  374.     int maxLeft, maxRight;
  375.     int highest, highestTID;
  376.     int i, j, k, l;
  377.     int heightTID = unusedTID(40000, 50000);
  378.  
  379.     curX = GetActorX(0);
  380.     curY = GetActorY(0);
  381.     curZ = GetActorZ(0);
  382.  
  383.     if (parkmoreOnGround(0) || grabbing[pln] || isDead(0)) { terminate; }
  384.  
  385.     switch (mode)
  386.     {
  387.       default:
  388.         GiveInventory("ParkmoreCheckGrab", 1);
  389.         break;
  390.  
  391.       case LW_WALL:
  392.         GiveInventory("OpenGrab", 1);
  393.         GiveInventory("ParkmoreCheckWallGrab", 1);
  394.         break;
  395.     }
  396.  
  397.     Delay(1);
  398.  
  399.     if (grabbing[pln] || GetActorVelZ(0) >= 0 ||
  400.         GetActorZ(0) - GetActorFloorZ(0) < 12.0)
  401.     {
  402.         TakeInventory("OpenGrab", 0x7FFFFFFF);
  403.         TakeInventory("CanGrab", 0x7FFFFFFF);
  404.         terminate;
  405.     }
  406.  
  407.     if (CheckInventory("OpenGrab") && CheckInventory("CanGrab"))
  408.     {
  409.         if (mode == LW_WALL)
  410.         {
  411.             ACS_ExecuteAlways(PARKMORE_WALLHOLD, 0, 0,0,0);
  412.             terminate;
  413.         }
  414.        
  415.         curX -= (8 * cos(curAngle));
  416.         curY -= (8 * sin(curAngle));
  417.         newZ = curZ+64.0;
  418.         curAngle = GetActorAngle(0);
  419.        
  420.         i = 4 * cos(curAngle);
  421.         j = 4 * sin(curAngle);
  422.        
  423.         for (k = 0; k < CACOUNT; k++) { Thing_Remove(heightTID+k); }
  424.        
  425.         while (ThingCounts(heightTID, heightTID+CACOUNT) == 0)
  426.         {
  427.             newZ += 8.0;
  428.            
  429.             if ((newZ - 512.0) > curZ)
  430.             {
  431.                 TakeInventory("OpenGrab", 0x7FFFFFFF);
  432.                 TakeInventory("CanGrab", 0x7FFFFFFF);
  433.                 terminate;
  434.             }
  435.            
  436.             for (k = 0; k < CACOUNT; k++)
  437.             {
  438.                 Thing_Remove(heightTID+k);
  439.                 l = k+3;
  440.                 Spawn("ParkmoreHeightFinder", curX + (i*l), curY + (j*l),
  441.                         newZ, heightTID+k);
  442.                 PlaceOnFloor(heightTID+k);
  443.             }
  444.         }
  445.        
  446.         // we got here, so one of them spawned
  447.         highest = GetActorZ(0);
  448.         highestTID = 0;
  449.        
  450.         for (i = 0; i < CACOUNT; i++)
  451.         {
  452.             j = heightTID + (CACOUNT-(i+1));
  453.            
  454.             if (GetActorZ(j) > highest)
  455.             {
  456.                 highest = GetActorZ(j);
  457.                 if (highestTID) { Thing_Remove(highestTID); }
  458.                 highestTID = j;
  459.             }
  460.             else
  461.             {
  462.                 Thing_Remove(j);
  463.             }
  464.         }
  465.        
  466.         if (highestTID == 0)
  467.         {
  468.             TakeInventory("OpenGrab", 0x7FFFFFFF);
  469.             TakeInventory("CanGrab", 0x7FFFFFFF);
  470.             terminate;
  471.         }
  472.        
  473.         heightTID = highestTID;
  474.         ACS_ExecuteAlways(PARKMORE_LEDGEHOLD, 0, heightTID,0,0);
  475.     }
  476.    
  477.     Delay(1);
  478.  
  479.     TakeInventory("OpenGrab", 0x7FFFFFFF);
  480.     TakeInventory("CanGrab", 0x7FFFFFFF);
  481.     terminate;
  482. }
  483.  
  484. script PARKMORE_LEDGEHOLD (int heightTID)
  485. {
  486.     int pln = PlayerNumber();
  487.     int oldSpeed, instantZ;
  488.     int curX, curY, curZ, newZ;
  489.     int curAngle;
  490.     int maxLeft, maxRight;
  491.     int ledgeMag, ledgeAngle;
  492.     int ledgeX,  ledgeY;
  493.     int ledgeMove;  // does two things, because of the 19 int max
  494.     int floorHeight, floorOldHeight;
  495.     int origDistance;
  496.     int i;
  497.    
  498.     curAngle = GetActorAngle(0);
  499.  
  500.     grabbing[pln] = 1;
  501.     TakeInventory("KickTrail", 1);
  502.     oldSpeed = GetActorProperty(0, APROP_Speed);
  503.     SetActorProperty(0, APROP_Speed, 0.0);
  504.     SetActorProperty(0, APROP_Gravity, 0);
  505.     SetActorVelocity(0, 24*cos(curAngle),24*sin(curAngle),9.0, 0, 1);
  506.  
  507.     newZ = GetActorZ(heightTID) - 36.0;
  508.  
  509.     Delay(1);
  510.     SetActorVelocity(0, 0,0,0, 0, 1);
  511.     ActivatorSound("parkmore/grabledge", 127);
  512.  
  513.     curX = GetActorX(0);
  514.     curY = GetActorY(0);
  515.     curZ = GetActorZ(0);
  516.  
  517.     floorHeight = GetActorFloorZ(heightTID);
  518.  
  519.     ledgeX       = GetActorX(heightTID) - curX;
  520.     ledgeY       = GetActorY(heightTID) - curY;
  521.     origDistance = magnitudeTwo(ftoi(ledgeX), ftoi(ledgeY));
  522.  
  523.     i =  0;
  524.     i =  (keyDown(BT_FORWARD) << 0);
  525.     i |= (keyDown(BT_BACK)    << 1);
  526.     i |= (keyDown(BT_JUMP)    << 2);
  527.  
  528.     while (1)
  529.     {
  530.         floorOldHeight = floorHeight;
  531.         floorHeight = GetActorFloorZ(heightTID);
  532.  
  533.         if (!PlayerInGame(pln) || isDead(0)) { break; }
  534.         if (GetActorZ(0) - GetActorFloorZ(0) <= 4.0) { break; }
  535.         if (abs(floorOldHeight - floorHeight) > 16.0)
  536.         {
  537.             SetActorVelocity(0, 0,0,0, 0,0);
  538.             break;
  539.         }
  540.  
  541.         newZ = GetActorZ(heightTID) - 44.0;
  542.         PlaceOnFloor(heightTID);
  543.  
  544.         if (curZ != newZ)
  545.         {
  546.             if ((abs(curZ - newZ) < 8.0) || instantZ) { curZ = newZ; }
  547.             else { curZ += (8.0 * sign(newZ - curZ)); }
  548.         }
  549.         else { instantZ = 1; }
  550.  
  551.         curX = GetActorX(0);
  552.         curY = GetActorY(0);
  553.  
  554.         ledgeX     = GetActorX(heightTID) - curX;
  555.         ledgeY     = GetActorY(heightTID) - curY;
  556.         ledgeMag   = magnitudeTwo(ftoi(ledgeX), ftoi(ledgeY));
  557.         ledgeAngle = VectorAngle(ledgeX, ledgeY);
  558.  
  559.         maxLeft  = ledgeAngle - 0.25;
  560.         maxRight = ledgeAngle + 0.25;
  561.  
  562.         curAngle = GetActorAngle(0);
  563.         ledgeMove = 0;
  564.        
  565.         if (maxLeft < 0)
  566.         {
  567.             if (curAngle > (0.5 + maxLeft)) { curAngle -= 1.0; }
  568.         }
  569.         else if (maxRight > 1.0)
  570.         {
  571.             if (curAngle < (maxRight - 0.5)) { curAngle += 1.0; }
  572.         }
  573.        
  574.         if (maxLeft > curAngle)  { ledgeMove = 1; }
  575.         if (maxRight < curAngle) { ledgeMove = 1; }
  576.  
  577.         SetActorPosition(0, curX, curY, curZ, 0);
  578.  
  579.         if (curZ - GetActorZ(0) > 16.0)
  580.         {
  581.             Spawn("FingerCrunch", GetActorX(0), GetActorY(0), GetActorZ(0)+24.0);
  582.             break;
  583.         }
  584.  
  585.         ledgeX /= max(1, ledgeMag);
  586.         ledgeY /= max(1, ledgeMag);
  587.  
  588.         SetActorVelocity(0, 24*ledgeX, 24*ledgeY,0, 0, 0);
  589.  
  590.         if (keyPressed(BT_BACK) && !ledgeMove)
  591.         {
  592.             break;
  593.         }
  594.         if (keyPressed(BT_BACK) && ledgeMove)
  595.         {
  596.             for (i = 0; i < 2; i++)
  597.             {
  598.                 curZ += 12.0;
  599.                 SetActorPosition(0, curX, curY, curZ, 0);
  600.                 Delay(1);
  601.             }
  602.             SetActorVelocity(0, -2*cos(curAngle),-2*sin(curAngle),9.0, 0, 1);
  603.             break;
  604.         }
  605.         if ((keyPressed(BT_FORWARD) && !ledgeMove) || (i & 1))  // i &= keyDown(BT_FORWARD);
  606.         {                                                       // right before while (1)
  607.             for (i = 0; i < 2; i++)
  608.             {
  609.                 curZ += 12.0;
  610.                 SetActorPosition(0, curX, curY, curZ, 0);
  611.                 Delay(1);
  612.             }
  613.             SetActorVelocity(0, 2*cos(curAngle),2*sin(curAngle),9.0, 0, 1);
  614.             break;
  615.         }
  616.         if (keyPressed(BT_FORWARD) && ledgeMove)
  617.         {
  618.             break;
  619.         }
  620.        
  621.         i = 0;
  622.  
  623.         if (!ledgeMove)  // if not facing the other way
  624.         {
  625.             ledgeMove = keyDown(BT_MOVELEFT) - keyDown(BT_MOVERIGHT);
  626.             ledgeMove *= 4;
  627.  
  628.             SetActorVelocity(heightTID, ledgeMove*cos(0.3+curAngle),ledgeMove*sin(0.3+curAngle),0, 0, 0);
  629.             SetActorVelocity(0, (4*ledgeMove)*cos(0.25+curAngle),(4*ledgeMove)*sin(0.25+curAngle),0, 1, 1);
  630.  
  631.             if (ledgeMove)
  632.             {
  633.                 ledgeX     = curX - GetActorX(heightTID);
  634.                 ledgeY     = curY - GetActorY(heightTID);
  635.                 ledgeAngle = VectorAngle(ledgeX, ledgeY);
  636.  
  637.                 ledgeX -= cos(ledgeAngle)*origDistance;
  638.                 ledgeY -= sin(ledgeAngle)*origDistance;
  639.  
  640.                 SetActorVelocity(heightTID, ledgeX,ledgeY,0, 1, 0);
  641.             }
  642.         }
  643.  
  644.         Delay(1);
  645.     }
  646.  
  647.     SetActorProperty(0, APROP_Gravity, 1.0);
  648.     SetActorProperty(0, APROP_Speed, oldSpeed);
  649.     Thing_Remove(heightTID);
  650.     grabbing[pln] = 0;
  651.     dontGrab[pln] = 1;
  652. }
  653.  
  654. script PARKMORE_WALLHOLD (void)
  655. {
  656.     int pln = PlayerNumber();
  657.     int oldSpeed;
  658.     int curX, curY, curZ;
  659.     int origAngle, curAngle;
  660.     int maxLeft, maxRight;
  661.     int facingWall;
  662.     int wallHit = 1, oldWallHit = 1;
  663.     int i;
  664.    
  665.     curAngle = GetActorAngle(0);
  666.     origAngle = curAngle;
  667.  
  668.     grabbing[pln] = 1;
  669.     TakeInventory("KickTrail", 1);
  670.     oldSpeed = GetActorProperty(0, APROP_Speed);
  671.  
  672.     SetActorProperty(0, APROP_Speed, 0.0);
  673.     SetActorProperty(0, APROP_Gravity, 0);
  674.     SetActorVelocity(0, 48*cos(curAngle),48*sin(curAngle),9.0, 0, 0);
  675.  
  676.     Delay(1);
  677.  
  678.     curAngle = GetActorAngle(0);
  679.     curX = GetActorX(0);
  680.     curY = GetActorY(0);
  681.     curZ = GetActorZ(0);
  682.  
  683.     while (1)
  684.     {
  685.         if (!PlayerInGame(pln) || isDead(0)) { break; }
  686.         if (GetActorZ(0) - GetActorFloorZ(0) <= 4.0) { break; }
  687.  
  688.         curX = GetActorX(0);
  689.         curY = GetActorY(0);
  690.         curZ = GetActorZ(0);
  691.         curAngle = GetActorAngle(0);
  692.  
  693.         maxLeft  = origAngle - 0.25;
  694.         maxRight = origAngle + 0.25;
  695.  
  696.         curAngle = GetActorAngle(0);
  697.         facingWall = 1;
  698.  
  699.         oldWallHit  = wallHit;
  700.         wallHit     = CheckInventory("CanGrab");
  701.         TakeInventory("CanGrab", 0x7FFFFFFF);
  702.         TakeInventory("ParkmoreAngleIndicator", 0x7FFFFFFF);
  703.         GiveInventory("ParkmoreAngleIndicator", ftoi(origAngle * 360));
  704.         GiveInventory("ParkmoreCheckWallGrab2", 1);
  705.  
  706.         if (!(wallHit || oldWallHit)) { break; }
  707.          
  708.         if (maxLeft < 0)
  709.         {
  710.             if (curAngle > (0.5 + maxLeft)) { curAngle -= 1.0; }
  711.         }
  712.         else if (maxRight > 1.0)
  713.         {
  714.             if (curAngle < (maxRight - 0.5)) { curAngle += 1.0; }
  715.         }
  716.        
  717.         if (maxLeft > curAngle)  { facingWall = 0; }
  718.         if (maxRight < curAngle) { facingWall = 0; }
  719.  
  720.         SetActorPosition(0, curX, curY, curZ, 0);
  721.  
  722.         if (facingWall) { SetActorVelocity(0, 0,0,-0.4, 0, 0); }
  723.         else            { SetActorVelocity(0, 0,0,-1.6, 0, 0); }
  724.  
  725.         if ((keyPressed(BT_BACK)    && !facingWall) ||
  726.             (keyPressed(BT_FORWARD) && facingWall))
  727.         {
  728.             break;
  729.         }
  730.  
  731.         if ((keyPressed(BT_FORWARD) && !facingWall) || keyPressed(BT_JUMP))
  732.         {
  733.             ACS_ExecuteAlways(PARKMORE_WALLBOUNCE, 0, WB_KICK, WD_FORWARD, 0);
  734.             break;
  735.         }
  736.  
  737.         if (keyPressed(BT_BACK) && facingWall)
  738.         {
  739.             ACS_ExecuteAlways(PARKMORE_WALLBOUNCE, 0, WB_KICK, WD_BACK, 0);
  740.             break;
  741.         }
  742.  
  743.         Delay(1);
  744.     }
  745.  
  746.     SetActorProperty(0, APROP_Gravity, 1.0);
  747.     SetActorProperty(0, APROP_Speed, oldSpeed);
  748.     grabbing[pln] = 0;
  749.     dontGrab[pln] = 1;
  750. }
  751.  
  752.  
  753. /*
  754. function void MultiJump(int countJump, int force)
  755. {
  756.     int pln = PlayerNumber();
  757.     int jumpHeight = getJumpZ();
  758.  
  759.     int forward, side, up;
  760.     int forwardx, forwardy, sidex, sidey;
  761.     int velx, vely, velz;
  762.     int angle = GetActorAngle(0);
  763.  
  764.     if ((force != 1) && (playerJumps[pln] + countJump > MaxJumpCount)) { return; }
  765.     if (playerJumps[pln] == 0) { return; }
  766.    
  767.     forward = keyDown(BT_FORWARD) - keyDown(BT_BACK);
  768.     forward *= cond(keyDown(BT_FORWARD), JUMP_FORWARD, JUMP_BACK);
  769.  
  770.     side    = keyDown(BT_MOVERIGHT) - keyDown(BT_MOVELEFT);
  771.     side    *= JUMP_SIDE;
  772.  
  773.     forwardx = FixedMul(cos(angle), forward);
  774.     forwardy = FixedMul(sin(angle), forward);
  775.  
  776.     sidex = FixedMul(cos(angle-0.25), side);
  777.     sidey = FixedMul(sin(angle-0.25), side);
  778.    
  779.     velx = forwardx + sidex;
  780.     vely = forwardy + sidey;
  781.  
  782.     playerJumps[pln] += countJump;
  783.  
  784.     if (velx || vely)
  785.     {
  786.         SetActorVelocity(0, velx, vely, jumpHeight, 0, 1);
  787.     }
  788.     else
  789.     {
  790.         SetActorVelocity(0, GetActorVelX(0), GetActorVelY(0), FixedMul(jumpHeight, 1.2), 0, 1);
  791.     }
  792. }
  793. */
  794.  
  795. function void MultiJump(int countJump, int force)
  796. {
  797.     int pln = PlayerNumber();
  798.     int jumpHeight = getJumpZ();
  799.  
  800.     if ((force != 1) && (MaxJumpCount >= 0) && (playerJumps[pln] + countJump > MaxJumpCount)) { return; }
  801.     if (playerJumps[pln] == 0) { return; }
  802.  
  803.     playerJumps[pln] += countJump;
  804.     ActivatorSound("parkmore/doubjump", 127);
  805.     SetActorVelocity(0, GetActorVelX(0), GetActorVelY(0), jumpHeight, 0, 1);
  806. }
  807.  
  808. function void Lunge(int force)
  809. {
  810.     int pln = PlayerNumber();
  811.     int jumpHeight = FixedMul(getJumpZ(), LUNGE_ZMULT);
  812.     int velx, vely, velz;
  813.     int angle = GetActorAngle(0);
  814.  
  815.     if ((force != 1) && (playerJumps[pln] != 0)) { return; }
  816.  
  817.     playerJumps[pln] += 1;
  818.  
  819.     velX = FixedMul(cos(angle), LUNGE_FORWARD);
  820.     velY = FixedMul(sin(angle), LUNGE_FORWARD);
  821.     velZ = jumpHeight;
  822.  
  823.     SetActorVelocity(0, velX, velY, velZ, 0, 1);
  824. }
  825.  
  826. function void HighJump(int force)
  827. {
  828.     int pln = PlayerNumber();
  829.     int jumpHeight = FixedMul(getJumpZ(), HIJUMP_ZMULT);
  830.     int velx, vely, velz;
  831.     int angle = GetActorAngle(0);
  832.  
  833.     if ((force != 1) && (playerJumps[pln] > 0)) { return; }
  834.  
  835.     playerJumps[pln] = max(playerJumps[pln]+1, 1);;
  836.  
  837.     velX = FixedMul(cos(angle), -HIJUMP_BACK);
  838.     velY = FixedMul(sin(angle), -HIJUMP_BACK);
  839.     velZ = jumpHeight;
  840.  
  841.     SetActorVelocity(0, velX, velY, velZ, 0, 1);
  842.     ACS_ExecuteAlways(PARKMORE_TURN, 0, 180, 6, random(0,1));
  843. }
  844.  
  845. /*  :DAEMONS
  846.  * The scripts that loop
  847.  */
  848.  
  849. script PARKMORE_OPEN open
  850. {
  851.     if (GetCVar("parkmore_jumpcount") == 0)
  852.     {
  853.         ConsoleCommand("set parkmore_jumpcount 2");
  854.         ConsoleCommand("archivecvar parkmore_jumpcount");
  855.     }
  856.  
  857.     IsServer = 1;
  858.  
  859.     int cjumps, oldcjumps;
  860.    
  861.     while (1)
  862.     {
  863.         oldcjumps = cjumps;
  864.         cjumps = GetCVar("parkmore_jumpcount");
  865.  
  866.         if (cjumps != oldcjumps) { MaxJumpCount = cjumps; }
  867.  
  868.         if (!GetCvar("compat_clientssendfullbuttoninfo")) { ConsoleCommand("set compat_clientssendfullbuttoninfo 1"); }
  869.         Delay(1);
  870.     }
  871. }
  872.  
  873. function int getTimer(int pln, int which)
  874. {
  875.     return playerTimers[pln][which];
  876. }
  877.  
  878. function void addTimer(int pln, int which, int add)
  879. {
  880.     if (add) { playerTimers[pln][which] = add; }
  881. }
  882.  
  883. function void addCTimers(int pln)
  884. {
  885.     int i = max(0, defaultCVar("parkmore_dodgewindow",  8));
  886.     int j = max(0, defaultCVar("parkmore_hijumpwindow", 4));
  887.  
  888.     addTimer(pln, TIMER_CFORWARD,  keyPressed(BT_FORWARD)   * i);
  889.     addTimer(pln, TIMER_CRIGHT,    keyPressed(BT_MOVERIGHT) * i);
  890.     addTimer(pln, TIMER_CBACK,     keyPressed(BT_BACK)      * i);
  891.     addTimer(pln, TIMER_CLEFT,     keyPressed(BT_MOVELEFT)  * i);
  892.     addTimer(pln, TIMER_HBACK,     keyPressed(BT_BACK)      * j);
  893. }
  894.  
  895. function int tickTimer(int pln, int timerNum)
  896. {
  897.     int i = max(playerTimers[pln][timerNum]-1, 0);
  898.     playerTimers[pln][timerNum] = i;
  899.     return i;
  900. }
  901.  
  902. function void tickTimers(int pln)
  903. {
  904.     int i;
  905.     for (i = 0; i < TIMER_COUNT; i++)
  906.     {
  907.         tickTimer(pln, i);
  908.     }
  909. }
  910.  
  911. function void printTimers(int pln)
  912. {
  913.     int i, j, printstr;
  914.     for (i = 0; i < TIMER_COUNT; i++)
  915.     {
  916.         j = playerTimers[pln][i];
  917.         printStr = StrParam(s:printStr, d:i, s:":", d:!!j, s:"  ");
  918.     }
  919.  
  920.     Print(s:printStr);
  921. }
  922.  
  923.  
  924. script PARKMORE_ENTER enter
  925. {
  926.     int pln = PlayerNumber();
  927.     int ground, wasGround, didSpecial;
  928.     int inWater, wasInWater;
  929.     int i;
  930.     int direction, dDirection;
  931.  
  932.     while (PlayerInGame(pln))
  933.     {
  934.         if (isDead(0))
  935.         {
  936.             playerJumps[pln] = 0;
  937.             hasKicked[pln] = 0;
  938.             grabbing[pln] = 0;
  939.             dontGrab[pln] = 0;
  940.             TakeInventory("KickTrail", 1);
  941.             Delay(1);
  942.             continue;
  943.         }
  944.  
  945.         if (hasKicked[pln] && !CheckInventory("HasKicked")) { GiveInventory("HasKicked", 1); }
  946.         if (!hasKicked[pln] && CheckInventory("HasKicked")) { TakeInventory("HasKicked", 0x7FFFFFFF); }
  947.  
  948.         wasGround = ground;
  949.         ground = parkmoreOnGround(0);
  950.  
  951.         PlayerGrounds[pln][0] = ground;
  952.         PlayerGrounds[pln][1] = wasGround;
  953.  
  954.         wasInWater = inWater;
  955.         inWater = CheckInventory("WaterIndicator");
  956.  
  957.         direction = getDirection();
  958.  
  959.         if (CheckInventory("NoParkour"))
  960.         {
  961.             TakeInventory("KickTrail", 1);
  962.             if (ground)
  963.             {
  964.                 playerJumps[pln] = 0;
  965.                 hasKicked[pln] = 0;
  966.                 grabbing[pln] = 0;
  967.                 dontGrab[pln] = 0;
  968.             }
  969.             else
  970.             {
  971.                 playerJumps[pln] = max(1, playerJumps[pln]);
  972.             }
  973.             Delay(1);
  974.             continue;
  975.         }
  976.  
  977.         didSpecial = 0;
  978.  
  979.         if (ground || inWater)
  980.         {
  981.             playerJumps[pln] = 0;
  982.             hasKicked[pln] = 0;
  983.             grabbing[pln] = 0;
  984.             dontGrab[pln] = 0;
  985.         }
  986.         else
  987.         {
  988.             playerJumps[pln] = max(1, playerJumps[pln]);
  989.  
  990.             if (!(ground || wasGround))
  991.             {
  992.                 if ((GetActorVelZ(0) < 0) && !grabbing[pln] && !dontGrab[pln])
  993.                 {
  994.                     ACS_ExecuteAlways(PARKMORE_LEDGEWALL, 0, LW_LEDGE,0,0);
  995.                 }
  996.             }
  997.         }
  998.  
  999.         tickTimer(pln, TIMER_BOUNCED);
  1000.         DidSpecials[pln] = max(0, DidSpecials[pln]-1);
  1001.  
  1002.         Delay(1);
  1003.     }
  1004. }
  1005.  
  1006. script PARKMORE_ENTER2 enter clientside
  1007. {
  1008.     int pln = PlayerNumber();
  1009.     int dodgeDir, pukeStr;
  1010.     int ground, wasGround, direction, dDirection;
  1011.     int inWater, wasInWater;
  1012.     int myLock = ClientEnterLocks[pln] + 1;
  1013.     int i;
  1014.  
  1015.     ClientEnterLocks[pln] = myLock;
  1016.  
  1017.     SetHudSize(480, 360, 1);
  1018.     HudMessage(s:"Input 'phelp' in the console for assistance.";
  1019.             HUDMSG_FADEOUT, 1337, CR_WHITE, 240.4, 70.0, 3.0, 2.0);
  1020.  
  1021.     while (ClientEnterLocks[pln] == myLock)
  1022.     {
  1023.         dodgeDir = -1;
  1024.         dDirection = -1;
  1025.  
  1026.         ground = parkmoreOnGround(0);
  1027.         direction = getDirection();
  1028.  
  1029.         if (ground) { wasGround = MJUMP_DELAY; }
  1030.         else { wasGround = max(0, wasGround-1); }
  1031.  
  1032.         wasInWater = inWater;
  1033.         inWater = CheckInventory("WaterIndicator");
  1034.  
  1035.         CPlayerGrounds[pln][0] = ground;
  1036.         CPlayerGrounds[pln][1] = wasGround;
  1037.  
  1038.         if (!(GetActorVelX(0) || GetActorVelY(0)))
  1039.         {
  1040.             playerTimers[pln][TIMER_CLEFT]      = 0;
  1041.             playerTimers[pln][TIMER_CFORWARD]   = 0;
  1042.             playerTimers[pln][TIMER_CRIGHT]     = 0;
  1043.             playerTimers[pln][TIMER_CBACK]      = 0;
  1044.         }
  1045.  
  1046.         if (!getTimer(pln, TIMER_DIDDODGE))
  1047.         {
  1048.             if (keyPressed(BT_MOVELEFT) && getTimer(pln, TIMER_CLEFT))
  1049.             {
  1050.                 dodgeDir = WD_LEFT;
  1051.             }
  1052.             else if (keyPressed(BT_FORWARD) && getTimer(pln, TIMER_CFORWARD))
  1053.             {
  1054.                 dodgeDir = WD_FORWARD;
  1055.             }
  1056.             else if (keyPressed(BT_MOVERIGHT) && getTimer(pln, TIMER_CRIGHT))
  1057.             {
  1058.                 dodgeDir = WD_RIGHT;
  1059.             }
  1060.             else if (keyPressed(BT_BACK) && getTimer(pln, TIMER_CBACK))
  1061.             {
  1062.                 dodgeDir = WD_BACK;
  1063.             }
  1064.  
  1065.             if (dodgeDir != -1)
  1066.             {
  1067.                 addTimer(pln, TIMER_DIDDODGE, 2);
  1068.  
  1069.                 if (!IsServer)
  1070.                 {
  1071.                     pukeStr = StrParam(s:"puke -", d:PARKMORE_REQUESTDODGE, s:" ", d:dodgeDir);
  1072.                     ConsoleCommand(pukeStr);
  1073.                 }
  1074.                 else
  1075.                 {
  1076.                     ACS_ExecuteWithResult(PARKMORE_WALLBOUNCE, WB_DODGE, dodgeDir, 0);
  1077.                 }
  1078.             }
  1079.         }
  1080.  
  1081.         if (!(getTimer(pln, TIMER_BOUNCED) || wasGround) && keyPressed(BT_JUMP) && direction != 0)
  1082.         {
  1083.             switch (direction)
  1084.             {
  1085.               case DIR_NW: dDirection = WD_FORWLEFT;    break;
  1086.               case DIR_N:  dDirection = WD_FORWARD;     break;
  1087.               case DIR_NE: dDirection = WD_FORWRITE;    break;
  1088.               case DIR_SW: dDirection = WD_BACKLEFT;    break;
  1089.               case DIR_S:  dDirection = WD_BACK;        break;
  1090.               case DIR_SE: dDirection = WD_BACKRITE;    break;
  1091.               case DIR_W:  dDirection = WD_LEFT;        break;
  1092.               case DIR_E:  dDirection = WD_RIGHT;       break;
  1093.             }
  1094.  
  1095.             i = 0;
  1096.             switch (dDirection)
  1097.             {
  1098.               case -1: break;
  1099.  
  1100.               case WD_FORWARD:
  1101.                 if (!CheckInventory("HasKicked")
  1102.                     && ACS_ExecuteWithResult(PARKMORE_WALLBOUNCE, WB_KICKUP, -WD_KICK))
  1103.                 {
  1104.                     i = 2; break;
  1105.                 }
  1106.            
  1107.               default:
  1108.                 if (ACS_ExecuteWithResult(PARKMORE_WALLBOUNCE, WB_KICK, -dDirection)) { i = 1; }
  1109.                 break;
  1110.             }
  1111.  
  1112.             if (i == 2)
  1113.             {
  1114.                 if (!IsServer)
  1115.                 {
  1116.                     pukeStr = StrParam(s:"puke -", d:PARKMORE_REQUESTDODGE, s:" ", d:-256);
  1117.                     ConsoleCommand(pukeStr);
  1118.                 }
  1119.                 else
  1120.                 {
  1121.                     ACS_ExecuteWithResult(PARKMORE_WALLBOUNCE, WB_KICKUP, WD_KICK);
  1122.                 }
  1123.             }
  1124.             else if (i == 1)
  1125.             {
  1126.                 if (!IsServer)
  1127.                 {
  1128.                     pukeStr = StrParam(s:"puke -", d:PARKMORE_REQUESTDODGE, s:" ", d:-dDirection);
  1129.                     ConsoleCommand(pukeStr);
  1130.                 }
  1131.                 else
  1132.                 {
  1133.                     ACS_ExecuteWithResult(PARKMORE_WALLBOUNCE, WB_KICK, dDirection);
  1134.                 }
  1135.             }
  1136.             else { dDirection = -1; }
  1137.  
  1138.            
  1139.             if (i) { addTimer(pln, TIMER_BOUNCED, 2); }
  1140.             //Print(s:"walljump: ", d:i, s:" (", d:dDirection, s:")");
  1141.         }
  1142.  
  1143.         if (keyPressed(BT_JUMP))
  1144.         {
  1145.             /*
  1146.             if (getTimer(pln, TIMER_HBACK) > 0)
  1147.             {
  1148.                 if (CPlayerGrounds[pln][1])
  1149.                 {
  1150.                     playerJumps[pln]--;
  1151.                     DidSpecials[pln] = 2;
  1152.                 }
  1153.                
  1154.                 if (!IsServer)
  1155.                 {
  1156.                     pukeStr = StrParam(s:"puke -", d:PARKMORE_REQUESTDODGE, s:" 0 1");
  1157.                     ConsoleCommand(pukeStr);
  1158.                 }
  1159.                 else if (ground)
  1160.                 {
  1161.                     playerJumps[pln]--;
  1162.                     HighJump(0);
  1163.                     DidSpecials[pln] = 2;
  1164.                 }
  1165.             }
  1166.             else*/
  1167.             if (!(ground || (GetActorVelZ(0) < 0 && wasGround) || wasGround >= (MJUMP_DELAY-2) || inWater || dDirection != -1))
  1168.             {
  1169.                 pukeStr = StrParam(s:"puke -", d:PARKMORE_REQUESTDODGE, s:" 0 0 1");
  1170.                 ConsoleCommand(pukeStr);
  1171.             }
  1172.         }
  1173.  
  1174.         tickTimer(pln, TIMER_CFORWARD);
  1175.         tickTimer(pln, TIMER_CRIGHT);
  1176.         tickTimer(pln, TIMER_CBACK);
  1177.         tickTimer(pln, TIMER_CLEFT);
  1178.         tickTimer(pln, TIMER_HBACK);
  1179.         addCTimers(pln);
  1180.  
  1181.         tickTimer(pln, TIMER_DIDDODGE);
  1182.         tickTimer(pln, TIMER_BOUNCED);
  1183.  
  1184.         Delay(1);
  1185.     }
  1186.  
  1187. }
  1188.  
  1189. script PARKMORE_REQUESTDODGE (int direction, int hijump, int mjump) net
  1190. {
  1191.     int pln;
  1192.  
  1193.     if (isDead(0)) { terminate; }
  1194.  
  1195.     if (mjump && !DidSpecials[pln] && !grabbing[pln])
  1196.     {
  1197.         if (!DidSpecials[pln] && !grabbing[pln]) { /*Print(d:playerJumps[pln]);*/ MultiJump(1, 0); }
  1198.     }
  1199.     else if (direction < 0)
  1200.     {
  1201.         direction = -direction;
  1202.         if (direction == 256) { ACS_ExecuteWithResult(PARKMORE_WALLBOUNCE, WB_KICKUP, WD_KICK); }
  1203.         else { ACS_ExecuteWithResult(PARKMORE_WALLBOUNCE, WB_KICK, direction); }
  1204.     }
  1205.     else
  1206.     {
  1207.         ACS_ExecuteWithResult(PARKMORE_WALLBOUNCE, WB_DODGE, direction, 0);
  1208.     }
  1209. }
  1210.  
  1211.  
  1212.  
  1213. /*  :USER
  1214.  * The customisable crap
  1215.  */
  1216.  
  1217. script PARKMORE_TOGGLE (int which) net
  1218. {
  1219.     switch (which)
  1220.     {
  1221.         case 0:
  1222.             if (CheckInventory("NoParkour")) { TakeInventory("NoParkour", 0x7FFFFFFF); }
  1223.             else { GiveInventory("NoParkour", 1); }
  1224.             break;
  1225.        
  1226.         case 1:
  1227.             GiveInventory("NoParkour", 1);
  1228.             break;
  1229.  
  1230.         case -1:
  1231.             TakeInventory("NoParkour", 0x7FFFFFFF);
  1232.             break;
  1233.     }
  1234.  
  1235.     if (CheckInventory("NoParkour")) { Print(s:"Parkmore is \cgDISABLED\c-."); }
  1236.     else { Print(s:"Parkmore is \cdENABLED\c-."); }
  1237. }
  1238.  
  1239. script PARKMORE_HELP (void) net clientside
  1240. {
  1241.     int i, j, k, l, signal;
  1242.  
  1243.     SetHudSize(480, 360, 1);
  1244.  
  1245.     SetFont("BIGFONT");
  1246.     HudMessage(s:"PARKMORE";
  1247.             HUDMSG_FADEINOUT|HUDMSG_LOG, HMSG_BASE, CR_YELLOW, 240.4, 20.1, 1.0, 1.0, 2.0);
  1248.  
  1249.     SetFont("SMALLFONT");
  1250.     HudMessage(s:"Yep, another Parkour mod";
  1251.             HUDMSG_FADEINOUT, HMSG_BASE+1, CR_BRICK, 240.4, 48.1, 1.0, 1.0, 2.0);
  1252.  
  1253.     Delay(35);
  1254.  
  1255.     SetFont("BIGFONT");
  1256.     HudMessage(s:"CYBERRUNNER";
  1257.             HUDMSG_PLAIN, HMSG_BASE, CR_LIGHTBLUE, 240.4, 20.1, 0.0);
  1258.  
  1259.     SetFont("SMALLFONT");
  1260.     HudMessage(s:"Race the Wind";
  1261.             HUDMSG_PLAIN, HMSG_BASE+1, CR_GOLD, 240.4, 48.1, 0.0);
  1262.  
  1263.     HudMessage(s:HELPMSGS[0];
  1264.             HUDMSG_FADEINOUT, HMSG_BASE+2, CR_WHITE, 240.4, 120.1, 1.0, 1.0, 0.0);
  1265.  
  1266.     Delay(35);
  1267.  
  1268.     for (i = 0; i < HELPMSGCOUNT; i++)
  1269.     {
  1270.         j = HELPTIMES[i];
  1271.         HudMessage(s:HELPMSGS[i];
  1272.                 HUDMSG_FADEOUT|HUDMSG_LOG, HMSG_BASE+2, CR_WHITE, 240.4, 120.1, 2.0, 2.0);
  1273.  
  1274.         for (k = 0; k < j; k++)
  1275.         {
  1276.             HudMessage(s:HELPMSGS[i];
  1277.                     HUDMSG_FADEOUT, HMSG_BASE+2, CR_WHITE, 240.4, 120.1, 2.0, 2.0);
  1278.  
  1279.             HudMessage(s:"\cf", d:j-k, s:"\c- second", s:cond(j-k != 1, "s", ""),
  1280.                        s:" left\n\ck", d:HELPMSGCOUNT-(i+1), s:"\c- screen",
  1281.                        s:cond(HELPMSGCOUNT-(i+1) != 1, "s", ""), s:" left\nHit \ca",
  1282.                        k:"+crouch", s:"\c- to end this\nHit \ca", k:"+moveleft",
  1283.                        s:"\c- and \ca", k:"+moveright", s:"\c- at the same time to",
  1284.                        s:" skip to the next screen";
  1285.                     HUDMSG_FADEOUT, HMSG_BASE+3, CR_GREEN, 240.4, 320.2, 1.0, 0.5);
  1286.  
  1287.             for (l = 0; l < 35; l++)
  1288.             {
  1289.                 if (keyPressed(BT_CROUCH)) { signal = 2; break; }
  1290.                 if (keyDown(BT_MOVELEFT | BT_MOVERIGHT))
  1291.                 {
  1292.                     if (signal != -1) { signal = 1; break; }
  1293.                 }
  1294.                 else
  1295.                 {
  1296.                     signal = 0;
  1297.                 }
  1298.                 Delay(1);
  1299.             }
  1300.  
  1301.             if (signal == 1) { signal = -1; break; }
  1302.             if (signal == 2) { break; }
  1303.         }
  1304.         if (signal == 2) { break; }
  1305.     }
  1306.  
  1307.     SetFont("BIGFONT");
  1308.     HudMessage(s:"CYBERRUNNER";
  1309.             HUDMSG_FADEOUT, HMSG_BASE, CR_LIGHTBLUE, 240.4, 20.1, 0.0, 2.0);
  1310.  
  1311.     SetFont("SMALLFONT");
  1312.     HudMessage(s:"Race the Wind";
  1313.             HUDMSG_FADEOUT, HMSG_BASE+1, CR_GOLD, 240.4, 48.1, 0.0, 2.0);
  1314. }
  1315.  
  1316.  
  1317.  
  1318. /*  :ASSORTED
  1319.  * Where everything else goes
  1320.  */
  1321.  
  1322. script PARKMORE_ASSORTED (int type, int a1, int a2)
  1323. {
  1324.     int pln = PlayerNumber();
  1325.     int x,y,z, ang, offset, tid;
  1326.     int i, j;
  1327.  
  1328.     switch (type)
  1329.     {
  1330.       case 0:
  1331.         x = GetActorX(0);
  1332.         y = GetActorY(0);
  1333.         z = GetActorZ(0);
  1334.  
  1335.         for (i = 0; i < a2; i++)
  1336.         {
  1337.             ang = random(0.0, 1.0);
  1338.            
  1339.             j = sqrt(itof(a1)/8);
  1340.             offset = random(0.0, j);
  1341.             offset = quad(1.0, 0.0, 0.0, offset);
  1342.             offset *= randSign();
  1343.             offset += itof(a1);
  1344.          
  1345.             Spawn("ParkmoreHeightTrail", x+FixedMul(offset,cos(ang)), y+FixedMul(offset,sin(ang)), z, tid);
  1346.         }
  1347.         break;
  1348.  
  1349.       case 1:
  1350.         SetResultValue(CheckInventory("ParkmoreAngleIndicator"));
  1351.         break;
  1352.     }
  1353. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement