Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "extdll.h"
- #include "util.h"
- #include "cbase.h"
- #include "monsters.h"
- #include "weapons.h"
- #include "nodes.h"
- #include "effects.h"
- #include "baseclasses.h"
- #include "player.h"
- #include "gamerules.h"
- #include <JutsuFx.h>
- #include <pakkun.h>
- #include <pm_defs.h>
- #include <rotationUtils.h>
- #define PAKKUN_SPAWN_DISTANCE 40
- #define PAKKUN_SPAWN_HEIGHT_DIFF 0
- #define WAIT_TIME 0.5
- #define ANIM_TIME 0.5
- #define TSUIGA_ANIMATION "ref_tsuiga"
- CTsuigaJutsu::CTsuigaJutsu( CBasePlayer *player):CBaseJutsu(player){}
- void CTsuigaJutsu::Activate(){
- CBaseJutsu::Activate();
- this->m_bActive = true;
- m_fWaitTime = 0;
- m_bSummonWait = false;
- SetState(EFIRE);
- }
- void CTsuigaJutsu::Fire(){
- //before we can actually fire the jutsu, we need to check whether or not
- //we have enough space in fron of us to spawn pakkun
- TraceResult tr;
- Vector origin = m_pPlayer->pev->origin + m_pPlayer->pev->playerNormal;
- Vector end = getSpawnPoint() + m_pPlayer->pev->playerNormal;
- ALERT( at_console, "Fire dog\n");
- //any idea why tracehull does not work as expected?
- UTIL_TraceHull(origin,end,dont_ignore_monsters,point_hull,ENT(m_pPlayer->pev),&tr);
- Vector dir = (end-origin).Normalize();
- char msg[255];
- sprintf(msg,"fraction: %f dir %f %f %f\n",tr.flFraction,dir.x,dir.y,dir.z);
- ClientPrint(m_pPlayer->pev,HUD_PRINTCONSOLE,msg);
- //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
- if(tr.flFraction < 1.0 ||!m_pPlayer->UseChakra(TSUIGA_CHAKRA * 0.01) || !m_bPakkunReady){
- ALERT( at_console, "CancelJutsu dog\n");
- CancelJutsu();
- return;
- }
- freeze();
- m_pPlayer->SetCorrectAnim(TSUIGA_ANIMATION,TSUIGA_ANIMATION);
- m_pPlayer->nextseqtime = gpGlobals->time + ANIM_TIME;
- SetState(ETIMED);
- }
- void CTsuigaJutsu::Timed(){
- m_fWaitTime += getTimeDiff();
- if(m_fWaitTime >= WAIT_TIME){
- ALERT( at_console, "CancelJutsu dog mfgezever: %f waittime:%f\n",m_fWaitTime,WAIT_TIME);
- //remove yaw and pitch from the view angles
- Vector angles = removePitchAndRoll(m_pPlayer->pev->v_angle, m_pPlayer->pev->playerNormal);
- Pakkun *pBolt = Pakkun::PakkunCreate(getSpawnPoint(),angles,m_pPlayer,this);
- EndJutsu();
- }else if(m_fWaitTime >= ANIM_TIME && !m_bSummonWait){
- //temp placeholder if we want the jutsu to charge
- m_pPlayer->SetCorrectAnim("ref_chidori_charge","ref_chidori_charge");
- m_pPlayer->nextseqtime = gpGlobals->time + WAIT_TIME - ANIM_TIME;
- m_bSummonWait = true;
- }
- }
- void CTsuigaJutsu::EndJutsu(){
- unfreeze();
- m_bActive = false;
- ALERT( at_console, "CTsuigaJutsu::EndJutsu() dog\n");
- CBaseJutsu::EndJutsu();
- }
- void CTsuigaJutsu::setPakkunReady(bool pr){
- m_bPakkunReady = pr;
- ALERT( at_console, "CTsuigaJutsu::setPakkunReady dog\n");
- }
- Vector CTsuigaJutsu::getSpawnPoint(){
- //get the globals
- UTIL_MakeVectors(m_pPlayer->pev->v_angle);
- //remove the normal component
- Vector forward = removeNormalComponent(gpGlobals->v_forward, m_pPlayer->pev->playerNormal);
- return m_pPlayer->pev->origin + PAKKUN_SPAWN_DISTANCE*forward - m_pPlayer->pev->playerNormal*PAKKUN_SPAWN_HEIGHT_DIFF;
- }
- /*TODO LIST:
- * [DONE] Poof sprite should appear on the pakkun model when he spawns
- * [DONE] Spawn sound should be taken from \sound\jutsu\Poof.wav
- * Yellow blood thingy removed
- * Sprite needs adding
- * Tsuiga sound for Kakashi needs adding (already commited)
- * Spawning sound for Pakkun's voice needs adding (I'll look for a good one and commit)
- Now for the technical things:
- * When summoning Pakkun, he should follow Kakashi at all times unless:
- 1. A player is xx feet near Kakashi/Pakkun.
- 2. Kakashi sends Pakkun to a certain direction.
- * Once Pakkun is hit even once, he poofs away.
- * Can only summon once at a time lol
- */
Add Comment
Please, Sign In to add comment