Guest User

Untitled

a guest
Jul 16th, 2018
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.78 KB | None | 0 0
  1. #include "extdll.h"
  2. #include "util.h"
  3. #include "cbase.h"
  4. #include "monsters.h"
  5. #include "weapons.h"
  6. #include "nodes.h"
  7. #include "effects.h"
  8. #include "baseclasses.h"
  9. #include "player.h"
  10. #include "gamerules.h"
  11.  
  12. #include <JutsuFx.h>
  13. #include <pakkun.h>
  14. #include <pm_defs.h>
  15. #include <rotationUtils.h>
  16.  
  17. #define PAKKUN_SPAWN_DISTANCE 40
  18. #define PAKKUN_SPAWN_HEIGHT_DIFF 0
  19.  
  20. #define WAIT_TIME 0.5
  21. #define ANIM_TIME 0.5
  22.  
  23. #define TSUIGA_ANIMATION "ref_tsuiga"
  24.  
  25. CTsuigaJutsu::CTsuigaJutsu( CBasePlayer *player):CBaseJutsu(player){}
  26.  
  27. void CTsuigaJutsu::Activate(){
  28. CBaseJutsu::Activate();
  29. this->m_bActive = true;
  30. m_fWaitTime = 0;
  31. m_bSummonWait = false;
  32. SetState(EFIRE);
  33. }
  34.  
  35. void CTsuigaJutsu::Fire(){
  36. //before we can actually fire the jutsu, we need to check whether or not
  37. //we have enough space in fron of us to spawn pakkun
  38. TraceResult tr;
  39. Vector origin = m_pPlayer->pev->origin + m_pPlayer->pev->playerNormal;
  40. Vector end = getSpawnPoint() + m_pPlayer->pev->playerNormal;
  41.  
  42. ALERT( at_console, "Fire dog\n");
  43.  
  44. //any idea why tracehull does not work as expected?
  45. UTIL_TraceHull(origin,end,dont_ignore_monsters,point_hull,ENT(m_pPlayer->pev),&tr);
  46. Vector dir = (end-origin).Normalize();
  47. char msg[255];
  48. sprintf(msg,"fraction: %f dir %f %f %f\n",tr.flFraction,dir.x,dir.y,dir.z);
  49. ClientPrint(m_pPlayer->pev,HUD_PRINTCONSOLE,msg);
  50. //note, this || is a or else, that means, once tr.flFraction is evaluated, the other part is not evaluated, and thus this wont consume chakra
  51. if(tr.flFraction < 1.0 ||!m_pPlayer->UseChakra(TSUIGA_CHAKRA * 0.01) || !m_bPakkunReady){
  52. ALERT( at_console, "CancelJutsu dog\n");
  53. CancelJutsu();
  54. return;
  55. }
  56. freeze();
  57. m_pPlayer->SetCorrectAnim(TSUIGA_ANIMATION,TSUIGA_ANIMATION);
  58. m_pPlayer->nextseqtime = gpGlobals->time + ANIM_TIME;
  59.  
  60. SetState(ETIMED);
  61. }
  62.  
  63. void CTsuigaJutsu::Timed(){
  64.  
  65.  
  66. m_fWaitTime += getTimeDiff();
  67.  
  68. if(m_fWaitTime >= WAIT_TIME){
  69. ALERT( at_console, "CancelJutsu dog mfgezever: %f waittime:%f\n",m_fWaitTime,WAIT_TIME);
  70. //remove yaw and pitch from the view angles
  71. Vector angles = removePitchAndRoll(m_pPlayer->pev->v_angle, m_pPlayer->pev->playerNormal);
  72. Pakkun *pBolt = Pakkun::PakkunCreate(getSpawnPoint(),angles,m_pPlayer,this);
  73. EndJutsu();
  74. }else if(m_fWaitTime >= ANIM_TIME && !m_bSummonWait){
  75. //temp placeholder if we want the jutsu to charge
  76. m_pPlayer->SetCorrectAnim("ref_chidori_charge","ref_chidori_charge");
  77. m_pPlayer->nextseqtime = gpGlobals->time + WAIT_TIME - ANIM_TIME;
  78. m_bSummonWait = true;
  79. }
  80. }
  81.  
  82. void CTsuigaJutsu::EndJutsu(){
  83. unfreeze();
  84. m_bActive = false;
  85. ALERT( at_console, "CTsuigaJutsu::EndJutsu() dog\n");
  86. CBaseJutsu::EndJutsu();
  87. }
  88.  
  89. void CTsuigaJutsu::setPakkunReady(bool pr){
  90. m_bPakkunReady = pr;
  91. ALERT( at_console, "CTsuigaJutsu::setPakkunReady dog\n");
  92. }
  93.  
  94. Vector CTsuigaJutsu::getSpawnPoint(){
  95. //get the globals
  96. UTIL_MakeVectors(m_pPlayer->pev->v_angle);
  97. //remove the normal component
  98. Vector forward = removeNormalComponent(gpGlobals->v_forward, m_pPlayer->pev->playerNormal);
  99. return m_pPlayer->pev->origin + PAKKUN_SPAWN_DISTANCE*forward - m_pPlayer->pev->playerNormal*PAKKUN_SPAWN_HEIGHT_DIFF;
  100. }
  101.  
  102. /*TODO LIST:
  103.  
  104.  
  105.  
  106. * [DONE] Poof sprite should appear on the pakkun model when he spawns
  107. * [DONE] Spawn sound should be taken from \sound\jutsu\Poof.wav
  108. * Yellow blood thingy removed
  109. * Sprite needs adding
  110. * Tsuiga sound for Kakashi needs adding (already commited)
  111. * Spawning sound for Pakkun's voice needs adding (I'll look for a good one and commit)
  112.  
  113. Now for the technical things:
  114.  
  115. * When summoning Pakkun, he should follow Kakashi at all times unless:
  116. 1. A player is xx feet near Kakashi/Pakkun.
  117. 2. Kakashi sends Pakkun to a certain direction.
  118.  
  119. * Once Pakkun is hit even once, he poofs away.
  120. * Can only summon once at a time lol
  121.  
  122. */
Add Comment
Please, Sign In to add comment