Advertisement
Guest User

Incorrect pitch calculation

a guest
Nov 5th, 2020
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 18.82 KB | None | 0 0
  1. //const int vehicle_Angle0 = 256;
  2. //const int vehicle_Angle1 = 360;
  3. //const int vehicle_Angle2 = 128;
  4.  
  5.  
  6. //------------------------------------------------------------------------------
  7. //CRASHES
  8. //------------------------------------------------------------------------------
  9. Class CrashTankIntotheGround1 : Actor
  10. {
  11. Default
  12. {
  13.     SeeSound "none";
  14.     DeathSound "none";
  15.     Decal "None";
  16.     Damagetype "Stomp";
  17.     Gravity 1.0;
  18.     +FORCERADIUSDMG;
  19.     Speed 1;
  20. }
  21.     States
  22.     {
  23.     Spawn:
  24.         TNT1 A 0;
  25.         Goto Death;
  26.     Death:
  27.         TNT1 A 0;
  28.         TNT1 A 0; //A_Explode(5000, 130, 0);
  29.         TNT1 A 1;
  30.         Stop;
  31.     }
  32. }
  33.  
  34. Class CrashTankIntotheGround2 : CrashTankIntotheGround1
  35. {
  36. Default
  37. {
  38.     Damagetype "Kick";
  39. }
  40.     States
  41.     {
  42.     Spawn:
  43.         TNT1 A 0;
  44.         Goto Death;
  45.     Death:
  46.         TNT1 A 0;
  47.         TNT1 A 0; //A_Explode(30, 220, 0);
  48.         TNT1 A 1;
  49.         Stop;
  50.     }
  51. }
  52.  
  53. //------------------------------------------------------------------------------
  54. //TOKENS AND PITCH POINTS
  55. //------------------------------------------------------------------------------
  56. Class MT_PitchFrontToken : Inventory
  57. {
  58. Default
  59. {
  60. Inventory.Amount 1;
  61. Inventory.MaxAmount 16;
  62. }
  63. }
  64.  
  65. Class MT_PitchRearToken : MT_PitchFrontToken {}
  66.  
  67. Class MT_PitchToRear : Inventory
  68. {
  69. Default
  70. {
  71. Inventory.Amount 1;
  72. Inventory.MaxAmount 1;
  73. }
  74. }
  75.  
  76. Class MT_PitchReset : MT_PitchToRear {}
  77.  
  78. Class MT_CBoxPitchFront : Actor
  79. {
  80. Default
  81. {
  82. PROJECTILE;
  83. +MISSILE;
  84. +THRUSPECIES;
  85. +DONTSPLASH;
  86. -EXPLODEONWATER;
  87. Radius 10;
  88. Height 5;
  89. Speed 0;
  90. Scale 0.5;
  91. Renderstyle "Add";
  92. Species "TankPlayer";
  93. }
  94. States
  95. {
  96. Spawn:
  97.     TNT1 A 0;
  98.     TNT1 A 0 A_GiveToTarget("MT_PitchFrontToken");
  99.     //TNT1 A 0 A_RadiusGive("MT_PitchFrontToken", 8, RGF_PLAYERS);
  100.     SPRA C 1;
  101.     Stop;
  102. Death:
  103.     SPRA A 2;
  104.     Stop;
  105. }}
  106.  
  107. Class MT_CBoxPitchRear : MT_CBoxPitchFront
  108. {
  109. Default
  110. {
  111. }
  112. States
  113. {
  114. Spawn:
  115.     TNT1 A 0;
  116.     TNT1 A 0 A_GiveToTarget("MT_PitchRearToken");
  117.     //TNT1 A 0 A_RadiusGive("MT_PitchRearToken", 8, RGF_PLAYERS);
  118.     SPRA C 1;
  119.     Stop;
  120. Death:
  121.     SPRA A 2;
  122.     Stop;
  123. }}
  124.  
  125.  
  126. Class CheckPitchCenter : MT_CBoxPitchFront
  127. {
  128. Default
  129. {
  130. Radius 28;
  131. Height 2;
  132. Scale 0.4;
  133. }
  134. States
  135. {
  136. Spawn:
  137.     TNT1 A 0 A_GiveToTarget("MT_PitchToRear");
  138.     X055 C 2;
  139.     Stop;
  140. Death:
  141.     TNT1 A 0 A_GiveToTarget("MT_PitchReset");
  142.     EBAR A 2;
  143.     Stop;
  144. }}
  145.  
  146. Class CheckPitchRunOver : CheckPitchCenter
  147. {
  148. Default
  149. {
  150. Speed 50;
  151. }
  152. States
  153.     {
  154. Spawn:
  155.     TNT1 A 1;
  156.     Stop;
  157. Death:
  158.     TNT1 A 0;
  159.     Stop;
  160. Xdeath:
  161.     TNT1 A 0 A_GiveToTarget("MT_PitchRearToken", 6);
  162.     Stop;
  163.     }
  164. }
  165.  
  166.  
  167. Class MT_Trig : Actor
  168. {
  169. Default
  170. {
  171. PROJECTILE;
  172. +MISSILE;
  173. +THRUSPECIES;
  174. +DONTSPLASH;
  175. -EXPLODEONWATER;
  176. Radius 5;
  177. Height 5;
  178. Speed 0;
  179. Scale 0.25;
  180. Renderstyle "Add";
  181. Species "TankPlayer";
  182. }
  183. States
  184. {
  185. Spawn:
  186.     TNT1 A 0;
  187.     TNT1 A 0 A_GiveToTarget("MT_PitchFrontToken");
  188.     Stop;
  189. Death:
  190.     SPRA A 2;
  191.     Stop;
  192. }}
  193.  
  194.  
  195. Class MT_Trig_B0 : MT_Trig
  196. {
  197. States
  198. {
  199. Spawn:
  200.     TNT1 A 0;
  201.     TNT1 A 0 ACS_NamedExecuteWithResult("MT_Set_Vertex_Height", 1, floorz);
  202. Death:
  203.     TNT1 A 0 ACS_NamedExecuteWithResult("MT_Set_Vertex_Height", 1, floorz);
  204.     SPRA C 2;
  205.     Stop;
  206. }}
  207.  
  208. Class MT_Trig_B1 : MT_Trig
  209. {
  210. States
  211. {
  212. Spawn:
  213.     TNT1 A 0;
  214.     TNT1 A 0 ACS_NamedExecuteWithResult("MT_Set_Vertex_Height", 2, floorz);
  215. Death:
  216.     TNT1 A 0 ACS_NamedExecuteWithResult("MT_Set_Vertex_Height", 2, floorz);
  217.     SPRA C 2;
  218.     Stop;
  219. }}
  220.  
  221.  
  222. Class MT_Trig_A0 : MT_Trig
  223. {
  224. States
  225. {
  226. Spawn:
  227.     TNT1 A 0;
  228.     TNT1 A 0 ACS_NamedExecuteWithResult("MT_Set_Vertex_Height", 3, floorz);
  229. Death:
  230.     TNT1 A 0 ACS_NamedExecuteWithResult("MT_Set_Vertex_Height", 3, floorz);
  231.     SPRA D 2;
  232.     Stop;
  233. }}
  234.  
  235. Class MT_Trig_A1 : MT_Trig
  236. {
  237. States
  238. {
  239. Spawn:
  240.     TNT1 A 0;
  241.     TNT1 A 0 ACS_NamedExecuteWithResult("MT_Set_Vertex_Height", 4, floorz);
  242. Death:
  243.     TNT1 A 0 ACS_NamedExecuteWithResult("MT_Set_Vertex_Height", 4, floorz);
  244.     SPRA D 2;
  245.     Stop;
  246. }}
  247.  
  248.  
  249. //------------------------------------------------------------------------------
  250. //TURRET
  251. //------------------------------------------------------------------------------
  252. Class MT_ChassisBase : Actor
  253. {
  254. int user_chassisangle;
  255. int user_chassispitch;
  256. int user_chassispitch_old;
  257. int user_pitch;
  258. double vertex_B0, vertex_B1, vertex_A0, vertex_A1;
  259. double deltapitch_front, deltapitch_rear, deltapitch;
  260. const chassis_spawnflag = SXF_ABSOLUTEVELOCITY | SXF_ABSOLUTEANGLE;
  261. const chassis_warpflag = WARPF_ABSOLUTEANGLE;
  262. Default
  263. {
  264. +THRUACTORS;
  265. +NOTIMEFREEZE;
  266. +CLIENTSIDEONLY;
  267. +FLOORCLIP;
  268. +NOGRAVITY;
  269. +FIXMAPTHINGPOS;
  270. +DONTINTERPOLATE;
  271. -FLOORCLIP;
  272. -FLOAT;
  273. Mass 99999;
  274. Radius 0;
  275. Height 0;
  276. Gravity 0;
  277. }
  278. States
  279. {
  280. Spawn:
  281. TNK1 A 1;
  282. TNK1 B 1;
  283. TNK1 C 1;
  284. Stop;
  285. }
  286.  
  287.  
  288. double MFunc_ResetPitch(double pitch = 0)
  289. {
  290.     double old_pitch = pitch;
  291.        
  292.     old_pitch = pitch;
  293.  
  294.     if (pitch != 0)
  295.         {old_pitch = old_pitch - (pitch * 2);}
  296.      
  297.     return old_pitch;
  298. }
  299.  
  300. void MFunc_VertexPitcher()
  301. {
  302.     //FRONT
  303.     A_SpawnItemEx("MT_Trig_B0", 16, 14, 1);
  304.     A_SpawnItemEx("MT_Trig_B1", 16, -14, 1);
  305.     //REAR
  306.     A_SpawnItemEx("MT_Trig_A0", -16, 14, 1);
  307.     A_SpawnItemEx("MT_Trig_A1", -16, -14, 1);
  308. }
  309.  
  310. double MFunc_CalcPitch(double A = 1)
  311. {
  312.     double new_pitch = 0;
  313.    
  314.     new_pitch = atan(A);
  315.    
  316.     return new_pitch;
  317. }
  318.  
  319. }
  320.  
  321. Class MT_HeavyTank_Chassis : MT_ChassisBase
  322. {
  323.     States
  324.     {
  325.     Spawn:
  326.         TNT1 A 0;
  327.         TNT1 A 0
  328.         {
  329.             user_chassisangle = 0;
  330.             user_chassispitch = 0;
  331.             user_pitch = 0;
  332.             user_chassisangle = CallACS("MT_GetVehicleRotation");
  333.         }
  334.         TNT1 A 1;
  335.         Goto Spawn2;
  336.  
  337.     Spawn2:
  338.         TNK1 A 1 A_Warp(AAPTR_TARGET, 0, 0, 0, user_chassisangle, chassis_warpflag, "Stay");
  339.         Goto Stay;
  340.    
  341.     DeMorph:
  342.         TNK1 "#" 1;
  343.         Goto Stay;
  344.        
  345.     Stay:
  346.         "####" "#" 0 A_JumpIfInventory("MT_MorphVCrewToken", 1, "Blank", AAPTR_TARGET);
  347.         //PITCH CHECK
  348.         "####" "#" 0
  349.         {
  350.             MFunc_VertexPitcher();
  351.             vertex_B0 = CallACS("MT_Get_Vertex_Height", 1) - CallACS("MT_ReturnHeight", 44440);
  352.             vertex_B1 = CallACS("MT_Get_Vertex_Height", 2) - CallACS("MT_ReturnHeight", 44440);
  353.             vertex_A0 = CallACS("MT_Get_Vertex_Height", 3) - CallACS("MT_ReturnHeight", 44440);
  354.             vertex_A1 = CallACS("MT_Get_Vertex_Height", 4) - CallACS("MT_ReturnHeight", 44440);
  355.             deltapitch_front = deltaangle(vertex_B0, vertex_B1);
  356.             deltapitch_rear = deltaangle(vertex_A0, vertex_A1);
  357.             deltapitch = deltaangle(deltapitch_front, deltapitch_rear);
  358.            
  359.             user_chassispitch = atan(deltapitch / 1);
  360.             //user_chassispitch = deltapitch;
  361.            
  362.             //A_LogFloat(CallACS("MT_ReturnHeight", 44440));
  363.             //A_LogFloat(vertex_B0);           
  364.             A_LogFloat(user_chassispitch);
  365.  
  366.             if (user_chassispitch > 0)
  367.             {
  368.                 A_Warp(AAPTR_TARGET, 0, 0, 0, CallACS("MT_GetVehicleRotation"), chassis_warpflag, null, 0, 0, MFunc_ResetPitch(pitch));
  369.                 A_Warp(AAPTR_TARGET, 0, 0, 0, CallACS("MT_GetVehicleRotation"), chassis_warpflag, null, 0, 0, user_chassispitch);      
  370.             }
  371.             else if (user_chassispitch < 0)
  372.             {
  373.                 A_Warp(AAPTR_TARGET, 0, 0, 0, CallACS("MT_GetVehicleRotation"), chassis_warpflag, null, 0, 0, MFunc_ResetPitch(pitch));
  374.                 A_Warp(AAPTR_TARGET, 0, 0, 0, CallACS("MT_GetVehicleRotation"), chassis_warpflag, null, 0, 0, -user_chassispitch);     
  375.             }
  376.             else if (user_chassispitch == 0)
  377.             {
  378.                 A_Warp(AAPTR_TARGET, 0, 0, 0, CallACS("MT_GetVehicleRotation"), chassis_warpflag, null, 0, 0, MFunc_ResetPitch(pitch));
  379.             }
  380.            
  381.  
  382.            
  383.         }      
  384.         //END PITCH CHECK
  385.     Movement:
  386.         "####" "#" 0 A_Warp(AAPTR_TARGET, 0, 0, 0, CallACS("MT_GetVehicleRotation"), chassis_warpflag);
  387.         "####" "#" 0 A_JumpIfInventory("Reverse", 1, "MoveB1", AAPTR_TARGET);
  388.         "####" "#" 0 A_JumpIfInventory("Accelerate", 1, "MoveF1", AAPTR_TARGET);
  389.         "####" "#" 0 A_JumpIfInventory("TurnLeft", 1, "MoveF1", AAPTR_TARGET);
  390.         "####" "#" 0 A_JumpIfInventory("TurnRight", 1, "MoveF1", AAPTR_TARGET);
  391.         "####" "#" 1;
  392.         Goto ItemClear;
  393.        
  394.        
  395.     //PITCH UP
  396.     PitchFront:
  397.         "####" "#" 0 A_JumpIfInventory("MT_PitchReset", 1, "PitchClear");
  398.         "####" "#" 0 A_JumpIfInventory("MT_PitchToRear", 3, "PitchRear");
  399.         //"####" "#" 0 A_Log("FRONT");
  400.         "####" "#" 0 {user_chassispitch = -user_pitch * countinv("MT_PitchRearToken");}
  401.         "####" "#" 0 A_Warp(AAPTR_TARGET, 0, 0, 0, CallACS("MT_GetVehicleRotation"), chassis_warpflag, null, 0, 0, MFunc_ResetPitch(pitch));
  402.         "####" "#" 0 A_Warp(AAPTR_TARGET, 0, 0, 0, CallACS("MT_GetVehicleRotation"), chassis_warpflag, null, 0, 0, user_chassispitch);
  403.         "####" "#" 1;
  404.         Goto ItemClear;
  405.  
  406.     //PITCH DOWN
  407.     PitchRear:
  408.         "####" "#" 0 A_JumpIfInventory("MT_PitchReset", 1, "PitchClear");
  409.         //"####" "#" 0 A_Log("REAR");
  410.         "####" "#" 0 {user_chassispitch = user_pitch * countinv("MT_PitchFrontToken");}
  411.         "####" "#" 0 A_Warp(AAPTR_TARGET, 0, 0, 0, CallACS("MT_GetVehicleRotation"), chassis_warpflag, null, 0, 0, MFunc_ResetPitch(pitch));
  412.         "####" "#" 0 A_Warp(AAPTR_TARGET, 0, 0, 0, CallACS("MT_GetVehicleRotation"), chassis_warpflag, null, 0, 0, -user_chassispitch);
  413.         "####" "#" 1;
  414.         Goto ItemClear;
  415.  
  416.     //PITCH CLEAR      
  417.     PitchClear:
  418.         "####" "#" 0 {
  419.             //A_Log("CLEAR");
  420.             user_chassispitch_old = MFunc_ResetPitch(pitch);
  421.             A_TakeInventory("MT_PitchToRear", 999);
  422.             A_TakeInventory("MT_PitchReset", 999);
  423.             A_TakeInventory("MT_PitchRearToken", 999);
  424.             A_TakeInventory("MT_PitchFrontToken", 999);
  425.         }
  426.         "####" "#" 0 A_Warp(AAPTR_TARGET, 0, 0, 0, CallACS("MT_GetVehicleRotation"), chassis_warpflag, null, 0, 0, MFunc_ResetPitch(pitch));
  427.         Goto Movement;
  428.    
  429.     ItemClear:
  430.         "####" "#" 0 {
  431.             user_chassispitch_old = user_chassispitch;
  432.             user_chassispitch = 0;
  433.             A_TakeInventory("MT_PitchToRear", 999);
  434.             A_TakeInventory("MT_PitchReset", 999);
  435.             A_TakeInventory("MT_PitchRearToken", 999);
  436.             A_TakeInventory("MT_PitchFrontToken", 999);
  437.         }
  438.         "####" "#" 0 A_Warp(AAPTR_TARGET, 0, 0, 0, CallACS("MT_GetVehicleRotation"), chassis_warpflag, null, 0, 0, user_chassispitch);
  439.         Goto Stay;
  440.    
  441.     //FORWARD
  442.     MoveF1:
  443.         "####" B 1 A_Warp(AAPTR_TARGET, 0, 0, 0, CallACS("MT_GetVehicleRotation"), chassis_warpflag);
  444.     MoveF2:
  445.         "####" C 1 A_Warp(AAPTR_TARGET, 0, 0, 0, CallACS("MT_GetVehicleRotation"), chassis_warpflag);
  446.     MoveF3:
  447.         "####" D 1 A_Warp(AAPTR_TARGET, 0, 0, 0, CallACS("MT_GetVehicleRotation"), chassis_warpflag);
  448.         Goto Stay;
  449.        
  450.     //BACKWARD
  451.     MoveB1:
  452.         "####" D 1 A_Warp(AAPTR_TARGET, 0, 0, 0, CallACS("MT_GetVehicleRotation"), chassis_warpflag);
  453.     MoveB2:
  454.         "####" C 1 A_Warp(AAPTR_TARGET, 0, 0, 0, CallACS("MT_GetVehicleRotation"), chassis_warpflag);
  455.     MoveB3:
  456.         "####" B 1 A_Warp(AAPTR_TARGET, 0, 0, 0, CallACS("MT_GetVehicleRotation"), chassis_warpflag);
  457.         Goto Stay;
  458.        
  459.     //TURN LEFT
  460.  
  461.     //TURN RIGHT
  462.  
  463.     Blank:
  464.         TNT1 A 1;
  465.         TNT1 A 0 A_JumpIf(CountInv("MT_MorphVCrewToken") == 0, "DeMorph");
  466.         loop;
  467.     }  
  468. }
  469.  
  470.  
  471. Class MT_BaseTank : PlayerPawn
  472. {
  473. const chassis_spawnflag = SXF_ABSOLUTEVELOCITY + SXF_ABSOLUTEANGLE + SXF_TRANSFERPITCH;
  474. const t_turnrate = 45; //tics turnrate
  475. const t_turnrate_move = 50; //tics turn rate + accel
  476. const turnrate = 4;
  477. const turnrate_move = 3;
  478. const accelerate = 1;
  479. const reverse = 1;
  480. int user_chassisangle;
  481. Default
  482. {
  483. player.DisplayName "BASE TANK";
  484. player.viewheight 25;
  485. player.attackzoffset 13;
  486. player.forwardmove 0.0;
  487. player.sidemove 0;
  488. player.jumpz 0;
  489. player.face "TKF";
  490. player.maxhealth 1600;
  491. health 1600;
  492. Speed 0.0;
  493. Species "TankPlayer";
  494. Player.SoundClass "mt_vehicle";
  495. MaxStepHeight 24;
  496. Radius 16;
  497. Height 20;
  498. Mass 50000;
  499. PainChance 128;
  500. BloodType "TankBlood", "TankBlood", "TankBlood";
  501. -FLOORCLIP;
  502. +FIXMAPTHINGPOS;
  503. +DONTRIP;
  504. Player.ColorRange 112, 127;
  505. //Internal stuff, very important
  506. Player.StartItem "MT_ClassToken"              ,1;
  507. Player.StartItem "MHTA1_Token"                ,1;
  508. Player.StartItem "MTU_SupplyBox_2"            ,1;
  509. Player.StartItem "MT_Subgun_Slot"             ,1;
  510. Player.StartItem "MT_AmmoSwitcher"            ,1;
  511. Player.StartItem "MT_AmmoSwitcher_Reverse"    ,1;
  512. Player.StartItem "MT_SubgunSwitcher"          ,1;
  513. Player.Startitem "MT_SubgunSwitcher_Reverse"  ,1;
  514. Player.Startitem "MT_Searchlight"             ,1;
  515. Player.StartItem "MT_Nightvision_MK1"         ,1;
  516. Player.StartItem "MT_ChaseCamera_MK1"         ,1;
  517. Player.StartItem "MT_PeriscopeItem"           ,1;
  518. //Lockers
  519. //Weapons
  520. Player.StartItem "MT_105mmCannon"           ,1;
  521. Player.StartItem "Multi_Purpose_Device"       ,1;
  522. //Ammo
  523. Player.Startitem "MT_75x500mmHE"                ,20;
  524. Player.Startitem "MT_75x500mmAP"                ,40;
  525. Player.Startitem "A_7u62x54mmR"                 ,2000;
  526. //Items
  527. //  Player.startitem "Item_GrenadePod_Smoke"        ,8
  528. Player.startitem "Item_GrenadePod_SSS"          ,1;
  529. Player.startitem "Item_GrenadePod_Illuminating" ,2;
  530. Player.startitem "MT_Item_GrenadePod_Flare"     ,30;
  531. Player.Startitem "MT_GrenadePod_Explosive"      ,20;
  532.  
  533. //MT Damage types
  534. DamageFactor "PiercingExplosive" ,0.75;
  535. DamageFactor "Piercing"          ,0.8;
  536. DamageFactor "Frag"              ,0.05;
  537. DamageFactor "Bullet"            ,0.15;
  538. DamageFactor "Acid"              ,0.5;
  539. DamageFactor "Chemical"          ,0.5;
  540. DamageFactor "Build"             ,0;
  541. //Other Damage types
  542. DamageFactor "Normal"            ,0.8;
  543. DamageFactor "Extreme"           ,0.8;
  544. DamageFactor "Drowning"          ,0.0;
  545. DamageFactor "Falling"           ,0.1;
  546. DamageFactor "Ice"               ,0.2;
  547. DamageFactor "Fire"              ,0.1;
  548. Damagefactor "stomp"             ,0;
  549. DamageFactor "Energy"            ,0.85;
  550. DamageFactor "Radiation"         ,0.0;
  551. DamageFactor "Nuclear"           ,0.9;
  552. DamageFactor "Explosive"         ,0.25;
  553. DamageFactor "Buckshot"          ,0;
  554. DamageFactor "Reclaim"           ,0.9;
  555. DamageFactor "Poison"            ,0;
  556. DamageFactor "PoisonCloud"       ,0;
  557. DamageFactor "Electric"          ,0.75;
  558. }
  559.     States
  560.     {
  561.     Pain:
  562.         "####" A 0;
  563.         "####" A 1 A_Pain;
  564.         Goto CheckIfStillMoves;
  565.  
  566.     Blank:
  567.         TNT1 A 0;
  568.         Goto Stay;
  569.  
  570.     //
  571.     //INITALIZATION
  572.     //
  573.     Spawn:
  574.         TNK1 A 0;
  575.         TNK1 A 0; //A_SetUserVar("user_chassisangle", CallACS("MTACS_Chassis_Init"))
  576.         TNK1 A 0 ThrustThingZ(0, 100, -1, 1);
  577.         TNK1 A 0 A_PlaySound("TankEngine/Start", 0, 0.8, 0, ATTN_IDLE);
  578.         TNK1 A 0
  579.         {
  580.             CallACS("MT_ChangeTid", 0, 44440);
  581.        
  582.             if ( GetCVAR("mtccvar_startup_noise") == 1 )
  583.             {
  584.                 A_PlaySound("GCrew/MissionStart");
  585.             }
  586.         }
  587.         TNK1 A 1;
  588.     Spawn2:
  589.         TNK1 A 0; //A_SetUserVar("user_chassisangle", CallACS("MTACS_Chassis_Init"))
  590.         TNK1 A 0; //A_SetUserVar("user_chassisangle", CallACS("MT_SetVehicleRotation"))
  591.         TNK1 A 0 {int user_chassisangle = 0;}
  592.         TNK1 A 0 A_SpawnItemEx ("MT_HeavyTank_Chassis" , 0, 0, 0, 0, 0, 0, user_chassisangle, chassis_spawnflag);
  593.         TNK1 A 1;
  594.         Goto Stay;
  595.    
  596.     DoNothing:
  597.         "####" A 1;
  598.         Goto Stay;
  599.        
  600.     //
  601.     //CHANGE MODEL/VISUAL
  602.     //
  603.  
  604.  
  605.     //
  606.     //DRIVE
  607.     //
  608.     CheckIfStillMoves:
  609.         "####" A 0;
  610.         "####" A 0 A_JumpIfInventory("ImCrafting", 1, "DoNothing");
  611.         "####" A 0 A_JumpIfInventory("Accelerate", 1, "Accelerate");
  612.         "####" A 0 A_JumpIfInventory("Reverse", 1, "Reverse");
  613.         "####" A 0 A_JumpIfInventory("TurnLeft", 1, "TurnLeft");
  614.         "####" A 0 A_JumpIfInventory("TurnRight", 1, "TurnRight");
  615.         "####" AAA 1;
  616.         "####" A 0 A_StopSound(5);
  617.         "####" A 0 A_PlaySound("Treads/Mid", 2);
  618.         Goto Stay; 
  619.  
  620.     CheckIfStillMoves2:
  621.         "####" A 0;
  622.         "####" A 0 A_JumpIfInventory("ImCrafting", 1, "DoNothing");
  623.         "####" A 0 A_JumpIfInventory("Accelerate", 1, "Accelerate");
  624.         "####" A 0 A_JumpIfInventory("Reverse", 1, "Reverse");
  625.         "####" A 0 A_JumpIfInventory("TurnLeft", 1, "TurnLeft");
  626.         "####" A 0 A_JumpIfInventory("TurnRight", 1, "TurnRight");
  627.         "####" AAA 1;
  628.         "####" A 0 A_StopSound(5);
  629.         "####" A 0 A_PlaySound("Treads/Left", 2);
  630.         Goto Stay; 
  631.    
  632.     Stay:
  633.         "####" A 0 A_JumpIfInventory("Reverse", 1, "Reverse");
  634.         "####" A 0 A_JumpIfInventory("Accelerate", 1, "Accelerate");
  635.         "####" A 0 A_JumpIfInventory("TurnLeft", 1, "TurnLeft");
  636.         "####" A 0 A_JumpIfInventory("TurnRight", 1, "TurnRight");
  637.         "####" A 1;
  638.         Goto Stay;
  639.        
  640.     Accelerate:
  641.         "####" A 0 {user_chassisangle = CallACS("MT_GetVehicleRotation");}
  642.         "####" A 0 A_PlaySound("Treads/Forward", 5, 1, 1);
  643.         "####" A 0 A_JumpIf(vel.z < 0, "Falling");
  644.         "####" A 1;
  645.         Goto CheckIfStillMoves;
  646.  
  647.     Reverse:
  648.         "####" A 0 {user_chassisangle = CallACS("MT_GetVehicleRotation");}
  649.         "####" A 0 A_PlaySound("Treads/Backward", 5, 1, 1);
  650.         "####" A 0 A_JumpIf(vel.z < 0, "Falling");
  651.         "####" A 1;
  652.         Goto CheckIfStillMoves;
  653.        
  654.     TurnRight:
  655.         "####" A 0 {user_chassisangle = CallACS("MT_GetVehicleRotation");}
  656.         "####" A 0 A_PlaySound("Treads/Left", 5, 1, 1);
  657.         "####" A 0 A_TakeInventory("TurnLeft", 999);
  658.         "####" A 0 A_TakeInventory("TurnRight", 999);
  659.         "####" A 0 A_JumpIf(vel.z < 0, "Falling");
  660.         "####" A 1;
  661.         Goto CheckIfStillMoves2;
  662.  
  663.     TurnLeft:      
  664.         "####" A 0 {user_chassisangle = CallACS("MT_GetVehicleRotation");}
  665.         "####" A 0 A_PlaySound("Treads/Right", 5, 1, 1);
  666.         "####" A 0 A_TakeInventory("TurnLeft", 999);
  667.         "####" A 0 A_TakeInventory("TurnRight", 999);
  668.         "####" A 0 A_JumpIf(vel.z < 0, "Falling");
  669.         "####" A 1;
  670.         Goto CheckIfStillMoves2;
  671.  
  672.  
  673.     //
  674.     //FALLING
  675.     //         
  676.     Falling:
  677.         "####" A 0;
  678.         "####" A 0 A_CheckFloor("CheckIfStillMoves");
  679.    
  680.     FallingForReal:
  681.         "####" A 0;
  682.         "####" A 1;
  683.         "####" A 0 A_JumpIF(vel.z == 0, "CrashIntoGround");
  684.         "####" A 0 A_GiveInventory("VehicleFallingCount", 1);
  685.         Loop;
  686.        
  687.     CrashIntoGround:
  688.         "####" A 0;
  689.         "####" A 0 A_JumpIfinventory("VehicleFallingCount", 10, "CrashIntoGroundViolently");
  690.         "####" A 1;
  691.         "####" A 0 A_SpawnItem("CrashTankIntotheGround1");
  692.         "####" A 0 A_SpawnItem("CrashTankIntotheGround2");
  693.         "####" A 0; //A_SpawnItemEx ("LargeMassWaterImpact", 0, 0, -10)
  694.         "####" A 0; //Radius_Quake(1, 6, 0, 4, 0)
  695.         "####" A 0 A_PlaySound("V_LightCrash", 2);
  696.         "####" A 0 A_TakeInventory("VehicleFallingCount", 9999);
  697.         Goto Stay;
  698.        
  699.     CrashIntoGroundViolently:
  700.         "####" A 0;
  701.         "####" A 1;
  702.         "####" A 0 A_SpawnItem("CrashTankIntotheGround1");
  703.         "####" A 0 A_SpawnItem("CrashTankIntotheGround2");
  704.        
  705.         "####" A 0; //A_SpawnItemEx ("ExplosionSplashSpawner", 0, 0, -10)
  706.        
  707.         "####" A 0; //Radius_Quake(8, 24, 0, 4, 0)
  708.         "####" A 0 A_PlaySound("V_LightCrash", 1);
  709.         "####" A 0 A_PlaySound("V_MediumCrash", 2);
  710.         "####" AAAA 0; //A_CustomMissile ("ExplosionSmoke", 0, 0, random (0, 360), 2, random (0, 360))
  711.         "####" A 0 A_TakeInventory("VehicleFallingCount", 9999);
  712.         "####" A 0 A_SetPitch(-8.0 + pitch);
  713.         "####" A 1;
  714.         "####" A 0 A_SetPitch(4.0 + pitch);
  715.         "####" A 1;
  716.         "####" A 0 A_SetPitch(4.0 + pitch);
  717.         Goto Stay;     
  718.     //
  719.     //KILLED/DESTROYED
  720.     // 
  721.     Death: 
  722.     XDeath:
  723.         "####" A 1;
  724.         "####" A 0; //A_SpawnItem("BigExplosion1112")
  725.         "####" A 0 A_PlaySound("weapons/explode");
  726.         "####" A 0 A_PlaySound("EXPLOSIO", 3);
  727.         "####" A 0 A_Scream;
  728.         "####" A 0 A_NoBlocking;
  729.         "####" AAAAAA 0; // A_CustomMissile ("MetalTrashParticle1", 96, 0, random (0, 360), 2, random (0, 180))
  730.         "####" AAAAAA 0; // A_CustomMissile ("MetalTrashParticle2", 96, 0, random (0, 360), 2, random (0, 180))
  731.         "####" AAAAAAAAA 0; // A_CustomMissile ("GlassShard", 96, 0, random (0, 360), 2, random (0, 360))
  732.         "####" A 0 A_Explode(100, 250);
  733.         "####" A 5;
  734.         "####" A 100;
  735.         "####" A -1;
  736.         Stop;
  737.     }  
  738.    
  739. }
  740. //------------------------------------------------------------------------------
  741. //CASEMATE
  742. //------------------------------------------------------------------------------
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement