Advertisement
Chronos_Ouroboros

Walljump

Oct 31st, 2017
369
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.86 KB | None | 0 0
  1. const WallJumpHitCount = 12.0;
  2. const WallJumpHitInterval = 45.0 / WallJumpHitCount;
  3. void Movement_WallJump () {
  4. if (playerData.wjumpJustJumped)
  5. playerData.wjumpJustJumped--;
  6.  
  7. if (health <= 0 || !playerData.wjumpJustJumped || CheckInventory ("S7_SoulLance_BeamGrabbed"))
  8.  
  9. double hCount = WallJumpHitCount / 2;
  10. double zOff = height / 2.0 + attackZOffset;
  11. Actor puff;
  12. if (player.cmd.forwardmove < 0 && (player.cmd.buttons & BT_JUMP) && !(player.oldbuttons & BT_JUMP) && (floorZ - pos.Z) > 24.0) {
  13. Vector3 normal, randomVec;
  14. normal.x = cos (-pitch) * cos (-angle);
  15. normal.y = cos (-pitch) * sin ( angle);
  16. normal.z = sin (-pitch);
  17. normal = normal.unit ();
  18.  
  19. do {
  20. randomVec = (frandom (-1, 1), frandom (-1, 1), frandom (-1, 1)).unit ();
  21. } while (randomVec == normal);
  22.  
  23. Vector3 normalPerp = (normal cross randomVec).unit ();
  24. Vector3 center = pos + (0, 0, (height / 2) + attackZOffset);
  25. Vector3 point1, point2;
  26. point1 = center + cos ( 45) * normal + sin ( 45) * normalPerp;
  27. point2 = center + cos (-90) * normal + sin (-90) * normalPerp;
  28.  
  29. for (int i = 0; i < WallJumpHitCount; i++) { //Force: XY: 18?, Z: 40?, S7_WalljumpMarker
  30. double hitAngle = WallJumpHitInterval * (i >= hCount ? i - 6 : i);
  31.  
  32. for (int j = 0; j < WallJumpHitCount; j++) {
  33. double hitPitch = WallJumpHitInterval * (j >= hCount ? j - 6 : j);
  34. puff = LineAttack (hitAngle, 48, hitPitch, 0, "None", "S7_WalljumpPuff", LAF_NoRandomPuffZ | LAF_NoImpactDecal, null, zOff);
  35. if (puff && (puff.GetZAt () - puff.pos.Z) >= 1.0) {
  36. // Destroy the puff
  37. puff.Destroy ();
  38. // Get the hit positions
  39. Vector3 hitPos1, hitPos2;
  40. let marker = Spawn ("S7_WalljumpMarker", point1);
  41. // Get hit position 1
  42. puff = LineAttack (hitAngle, 48, hitPitch, 0, "None", "S7_WalljumpPuff", LAF_NoRandomPuffZ | LAF_NoImpactDecal, null, zOff);
  43. if (!puff) continue;
  44. hitPos1 = puff.pos; puff.Destroy ();
  45. // Get hit position 2
  46. puff = LineAttack (hitAngle, 48, hitPitch, 0, "None", "S7_WalljumpPuff", LAF_NoRandomPuffZ | LAF_NoImpactDecal, null, zOff);
  47. if (!puff) continue;
  48. hitPos2 = puff.pos; puff.Destroy ();
  49.  
  50.  
  51.  
  52. //playerData.wjumpJustJumped = WJUMPDELAY;
  53. //A_SetAngle ();
  54. }
  55. }
  56. }
  57. }
  58. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement