Advertisement
Qent

mage stuff

Dec 29th, 2011
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 3.55 KB | None | 0 0
  1. //============================================================================
  2. //
  3. // A_FireConePL1
  4. //
  5. //============================================================================
  6.  
  7. void A_FireConePL1 (AActor *actor)
  8. {
  9.     angle_t angle;
  10.     int damage;
  11.     int slope;
  12.     int i;
  13.     AActor *mo;
  14.     bool conedone=false;
  15.     player_t *player;
  16.  
  17.     if (NULL == (player = actor->player))
  18.     {
  19.         return;
  20.     }
  21.  
  22.     AWeapon *weapon = actor->player->ReadyWeapon;
  23.     if (weapon != NULL)
  24.     {
  25.         if (!weapon->DepleteAmmo (weapon->bAltFire))
  26.             return;
  27.     }
  28.     S_Sound (actor, CHAN_WEAPON, "MageShardsFire", 1, ATTN_NORM);
  29.  
  30.     // [BC] Weapons are handled by the server.
  31.     if ( NETWORK_GetState( ) == NETSTATE_CLIENT )
  32.         return;
  33.  
  34.     damage = 90+(pr_cone()&15);
  35.     for (i = 0; i < 16; i++)
  36.     {
  37.         angle = actor->angle+i*(ANG45/16);
  38.         slope = P_AimLineAttack (actor, angle, MELEERANGE);
  39.         if (linetarget)
  40.         {
  41.             P_DamageMobj (linetarget, actor, actor, damage, MOD_ICE);
  42.             conedone = true;
  43.             break;
  44.         }
  45.     }
  46.  
  47.     // didn't find any creatures, so fire projectiles
  48.     if (!conedone)
  49.     {
  50.         mo = P_SpawnPlayerMissile (actor, RUNTIME_CLASS(AFrostMissile));
  51.         if (mo)
  52.         {
  53.             mo->special1 = SHARDSPAWN_LEFT|SHARDSPAWN_DOWN|SHARDSPAWN_UP
  54.                 |SHARDSPAWN_RIGHT;
  55.             mo->special2 = 3; // Set sperm count (levels of reproductivity)
  56.             mo->target = actor;
  57.             mo->args[0] = 3;        // Mark Initial shard as super damage
  58.         }
  59.     }
  60. }
  61.  
  62. //============================================================================
  63. //
  64. // A_ShedShard
  65. //
  66. //============================================================================
  67.  
  68. void A_ShedShard (AActor *actor)
  69. {
  70.     AActor *mo;
  71.     int spawndir = actor->special1;
  72.     int spermcount = actor->special2;
  73.  
  74.     if (spermcount <= 0) return;                // No sperm left
  75.     actor->special2 = 0;
  76.     spermcount--;
  77.  
  78.     // every so many calls, spawn a new missile in its set directions
  79.     if (spawndir & SHARDSPAWN_LEFT)
  80.     {
  81.         mo = P_SpawnMissileAngleZSpeed (actor, actor->z, RUNTIME_CLASS(AFrostMissile), actor->angle+(ANG45/9),
  82.                                              0, (20+2*spermcount)<<FRACBITS, actor->target);
  83.         if (mo)
  84.         {
  85.             mo->special1 = SHARDSPAWN_LEFT;
  86.             mo->special2 = spermcount;
  87.             mo->momz = actor->momz;
  88.             mo->args[0] = (spermcount==3)?2:0;
  89.         }
  90.     }
  91.     if (spawndir & SHARDSPAWN_RIGHT)
  92.     {
  93.         mo = P_SpawnMissileAngleZSpeed (actor, actor->z, RUNTIME_CLASS(AFrostMissile), actor->angle-(ANG45/9),
  94.                                              0, (20+2*spermcount)<<FRACBITS, actor->target);
  95.         if (mo)
  96.         {
  97.             mo->special1 = SHARDSPAWN_RIGHT;
  98.             mo->special2 = spermcount;
  99.             mo->momz = actor->momz;
  100.             mo->args[0] = (spermcount==3)?2:0;
  101.         }
  102.     }
  103.     if (spawndir & SHARDSPAWN_UP)
  104.     {
  105.         mo = P_SpawnMissileAngleZSpeed (actor, actor->z+8*FRACUNIT, RUNTIME_CLASS(AFrostMissile), actor->angle,
  106.                                              0, (15+2*spermcount)<<FRACBITS, actor->target);
  107.         if (mo)
  108.         {
  109.             mo->momz = actor->momz;
  110.             if (spermcount & 1)         // Every other reproduction
  111.                 mo->special1 = SHARDSPAWN_UP | SHARDSPAWN_LEFT | SHARDSPAWN_RIGHT;
  112.             else
  113.                 mo->special1 = SHARDSPAWN_UP;
  114.             mo->special2 = spermcount;
  115.             mo->args[0] = (spermcount==3)?2:0;
  116.         }
  117.     }
  118.     if (spawndir & SHARDSPAWN_DOWN)
  119.     {
  120.         mo = P_SpawnMissileAngleZSpeed (actor, actor->z-4*FRACUNIT, RUNTIME_CLASS(AFrostMissile), actor->angle,
  121.                                              0, (15+2*spermcount)<<FRACBITS, actor->target);
  122.         if (mo)
  123.         {
  124.             mo->momz = actor->momz;
  125.             if (spermcount & 1)         // Every other reproduction
  126.                 mo->special1 = SHARDSPAWN_DOWN | SHARDSPAWN_LEFT | SHARDSPAWN_RIGHT;
  127.             else
  128.                 mo->special1 = SHARDSPAWN_DOWN;
  129.             mo->special2 = spermcount;
  130.             mo->target = actor->target;
  131.             mo->args[0] = (spermcount==3)?2:0;
  132.         }
  133.     }
  134. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement