daily pastebin goal
12%
SHARE
TWEET

Untitled

a guest Jan 16th, 2018 72 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. void CWarpGreen::Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value)
  2. {
  3.     int iTimes = 0;
  4.     int iDrawn = 0;
  5.     TraceResult tr1;    TraceResult tr2;    TraceResult tr3;    TraceResult tr4;    TraceResult tr5;    TraceResult tr6;
  6.     Vector vecDest1;    Vector vecDest2;    Vector vecDest3;    Vector vecDest4;    Vector vecDest5;    Vector vecDest6;
  7.     CBeam *pBeam1;  CBeam *pBeam2;  CBeam *pBeam3;  CBeam *pBeam4;  CBeam *pBeam5; CBeam *pBeam6;
  8.  
  9.     while (iDrawn<pev->frags && iTimes<(pev->frags * 8)) // try to draw <frags> beams, but give up after 3x<frags> tries.
  10.     {
  11.         // 1ST
  12.         vecDest1 = pev->health * (Vector(RANDOM_FLOAT(-1, 1), RANDOM_FLOAT(-1, 1), RANDOM_FLOAT(-1, 1)).Normalize());
  13.         UTIL_TraceLine(pev->origin, pev->origin + vecDest1, ignore_monsters, NULL, &tr1);
  14.         UTIL_TraceLine(pev->origin, pev->origin + vecDest2, ignore_monsters, NULL, &tr2);
  15.         UTIL_TraceLine(pev->origin, pev->origin + vecDest3, ignore_monsters, NULL, &tr3);
  16.         UTIL_TraceLine(pev->origin, pev->origin + vecDest4, ignore_monsters, NULL, &tr4);
  17.         UTIL_TraceLine(pev->origin, pev->origin + vecDest5, ignore_monsters, NULL, &tr5);
  18.         UTIL_TraceLine(pev->origin, pev->origin + vecDest6, ignore_monsters, NULL, &tr6);
  19.         if (tr1.flFraction != 1.0) // we hit something.
  20.         {
  21.             iDrawn++;
  22.             pBeam1 = CBeam::BeamCreate("sprites/lgtning.spr", 200);
  23.             pBeam1->PointsInit(pev->origin, tr1.vecEndPos);
  24.             pBeam1->pev->spawnflags |= (SF_BEAM_SPARKSTART | SF_BEAM_SPARKEND | SF_BEAM_DECALS | SF_BEAM_SHADEIN | SF_BEAM_SHADEOUT);
  25.             pBeam1->SetColor(145, 243, 115);
  26.             pBeam1->SetNoise(100);
  27.             pBeam1->SetBrightness(255);
  28.             pBeam1->SetWidth(32);
  29.             pBeam1->SetScrollRate(55);
  30.  
  31.             pBeam1->pev->nextthink = gpGlobals->time + 0.1f;
  32.             pBeam1->SetThink(&CBeam::SUB_Remove);
  33.             pBeam1->PointsInit(pev->origin, tr2.vecEndPos);
  34.             pBeam1->RelinkBeam;
  35.  
  36.             pBeam1->pev->nextthink = gpGlobals->time + 0.1f;
  37.             pBeam1->SetThink(&CBeam::SUB_Remove);
  38.             pBeam1->PointsInit(pev->origin, tr3.vecEndPos);
  39.             pBeam1->RelinkBeam;
  40.  
  41.             pBeam1->pev->nextthink = gpGlobals->time + 0.1f;
  42.             pBeam1->SetThink(&CBeam::SUB_Remove);
  43.             pBeam1->PointsInit(pev->origin, tr4.vecEndPos);
  44.             pBeam1->RelinkBeam;
  45.  
  46.             pBeam1->pev->nextthink = gpGlobals->time + 0.1f;
  47.             pBeam1->SetThink(&CBeam::SUB_Remove);
  48.             pBeam1->PointsInit(pev->origin, tr5.vecEndPos);
  49.             pBeam1->RelinkBeam;
  50.  
  51.             pBeam1->pev->nextthink = gpGlobals->time + 0.1f;
  52.             pBeam1->SetThink(&CBeam::SUB_Remove);
  53.             pBeam1->PointsInit(pev->origin, tr6.vecEndPos);
  54.             pBeam1->RelinkBeam;
  55.         }
  56.         iTimes++;
  57.  
  58.     }
  59.     //EMIT_SOUND(edict(), CHAN_BODY, "debris/beamstart2.wav", 1, ATTN_NORM);
  60.     gSOUND.PlayScriptSound("XEN.beamstart2", pev->origin);
  61.  
  62.     CSprite *pSpr = CSprite::SpriteCreate("sprites/exit1.spr", pev->origin, TRUE);
  63.     pSpr->SetScale(0.80);
  64.     pSpr->AnimateAndDie(32);
  65.     pSpr->SetTransparency(kRenderGlow, 255, 255, 255, 255, kRenderFxNoDissipation);
  66.  
  67.     //CSprite *pSpr =
  68.     //CSprite *pSpr = CSprite::SpriteCreate("sprites/XFlare1.spr", pev->origin, TRUE);
  69.     pSpr = CSprite::SpriteCreate("sprites/XFlare1.spr", pev->origin, TRUE);
  70.     pSpr->pev->frame = 0;
  71.     pSpr->SetScale(4);
  72.     pSpr->AnimateAndDie(24);
  73.     pSpr->SetTransparency(kRenderGlow, 147, 250, 92, 200, kRenderFxNoDissipation);
  74.  
  75.     pev->nextthink = gpGlobals->time + 0.1f;
  76. }
  77.  
  78. void CWarpGreen::Think(void)
  79. {
  80.     UTIL_WarpGreen(pev->origin);
  81.     //EMIT_SOUND(edict(), CHAN_ITEM, "debris/beamstart7.wav", 1, ATTN_NORM);
  82.     gSOUND.PlayScriptSound("XEN.beamstart7", pev->origin);
  83.     SUB_UseTargets(this, USE_TOGGLE, 0);
  84. }
RAW Paste Data
Top