Merge branch 'master' into Mario/monsters
authorMario <mario.mario@y7mail.com>
Tue, 21 Jan 2020 20:35:01 +0000 (06:35 +1000)
committerMario <mario.mario@y7mail.com>
Tue, 21 Jan 2020 20:35:01 +0000 (06:35 +1000)
1  2 
qcsrc/common/mapobjects/func/breakable.qc
qcsrc/common/monsters/monster/spider.qc
qcsrc/common/monsters/monster/wyvern.qc
qcsrc/menu/xonotic/util.qc
qcsrc/server/autocvars.qh
qcsrc/server/g_world.qc
qcsrc/server/miscfunctions.qc
qcsrc/server/miscfunctions.qh

index 7d021f4c267f5de5d73c86b166852ce98b23cb64,d9a51c05e9a4649718deac200f0e5f4beeff9b6a..518b93035de7865f301a433e5ec4932b63495024
@@@ -59,17 -58,15 +59,18 @@@ METHOD(SpiderAttack, wr_think, void(Spi
      TC(SpiderAttack, thiswep);
      bool isPlayer = IS_PLAYER(actor);
      if (fire & 1)
 -    if ((!isPlayer && time >= actor.spider_web_delay) || weapon_prepareattack(thiswep, actor, weaponentity, false, autocvar_g_monster_spider_attack_web_delay)) {
 +    if ((!isPlayer && time >= actor.spider_web_delay) || (isPlayer && weapon_prepareattack(thiswep, actor, weaponentity, false, autocvar_g_monster_spider_attack_web_delay))) {
                if (!isPlayer) {
 -                      actor.spider_web_delay = time + 3;
 +                      actor.spider_web_delay = time + autocvar_g_monster_spider_attack_web_delay;
                        setanim(actor, actor.anim_shoot, true, true, true);
 -                      actor.attack_finished_single[0] = time + (autocvar_g_monster_spider_attack_web_delay);
 -                      actor.anim_finished = time + 1;
 +                      if(actor.animstate_endtime > time)
 +                              actor.anim_finished = actor.animstate_endtime;
 +                      else
 +                              actor.anim_finished = time + 1;
 +                      actor.attack_finished_single[0] = actor.anim_finished + 0.2;
                }
          if (isPlayer) actor.enemy = Monster_FindTarget(actor);
+         monster_makevectors(actor, actor.enemy);
          W_SetupShot_Dir(actor, weaponentity, v_forward, false, 0, SND_SpiderAttack_FIRE, CH_WEAPON_B, 0, DEATH_MONSTER_SPIDER.m_id);
        if (!isPlayer) w_shotdir = normalize((actor.enemy.origin + '0 0 10') - actor.origin);
                M_Spider_Attack_Web(actor);
Simple merge
Simple merge
Simple merge
index 4c5bef5979bf0841657b24cb4797afb827aae898,6e2bbb8d7cd3c8a52868f9d3456c6b17d789db04..14f704f5478214461a09ac78fcf3a7efe88c5a4f
@@@ -1257,20 -1274,18 +1274,18 @@@ string uid2name(string myuid
        return s;
  }
  
 -bool MoveToRandomLocationWithinBounds(entity e, vector boundmin, vector boundmax, float goodcontents, float badcontents, float badsurfaceflags, int attempts, float maxaboveground, float minviewdistance)
 +bool MoveToRandomLocationWithinBounds(entity e, vector boundmin, vector boundmax, float goodcontents, float badcontents, float badsurfaceflags, int attempts, float maxaboveground, float minviewdistance, bool frompos)
  {
-     float m, i;
-     vector start, org, delta, end, enddown, mstart;
-     m = e.dphitcontentsmask;
+     float m = e.dphitcontentsmask;
      e.dphitcontentsmask = goodcontents | badcontents;
  
-     org = boundmin;
-     delta = boundmax - boundmin;
+     vector org = boundmin;
+     vector delta = boundmax - boundmin;
  
+     vector start, end;
      start = end = org;
-     for (i = 0; i < attempts; ++i)
+     int j; // used after the loop
+     for(j = 0; j < attempts; ++j)
      {
          start.x = org.x + random() * delta.x;
          start.y = org.y + random() * delta.y;
          if (trace_fraction >= 1 || trace_dphittexturename == "common/caulk")
              continue;
  
-       // rule 4: we must "see" some spawnpoint or item
-     entity sp = NULL;
-     if(frompos)
-     {
-       if((traceline(mstart, e.origin, MOVE_NORMAL, e), trace_fraction) >= 1)
-               sp = e;
-     }
-     if(!sp)
-     {
-           IL_EACH(g_spawnpoints, checkpvs(mstart, it),
+               // rule 4: we must "see" some spawnpoint or item
+           entity sp = NULL;
 -          IL_EACH(g_spawnpoints, checkpvs(mstart, it),
++          if(frompos)
            {
--              if((traceline(mstart, it.origin, MOVE_NORMAL, e), trace_fraction) >= 1)
--              {
--                      sp = it;
--                      break;
--              }
--          });
-       }
-       if(!sp)
-       {
-               int items_checked = 0;
-               IL_EACH(g_items, checkpvs(mstart, it),
++              if((traceline(mstart, e.origin, MOVE_NORMAL, e), trace_fraction) >= 1)
++                      sp = e;
++          }
++          if(!sp)
++          {
++                  IL_EACH(g_spawnpoints, checkpvs(mstart, it),
++                  {
++                      if((traceline(mstart, it.origin, MOVE_NORMAL, e), trace_fraction) >= 1)
++                      {
++                              sp = it;
++                              break;
++                      }
++                  });
++              }
+               if(!sp)
                {
-                       if((traceline(mstart, it.origin + (it.mins + it.maxs) * 0.5, MOVE_NORMAL, e), trace_fraction) >= 1)
+                       int items_checked = 0;
+                       IL_EACH(g_items, checkpvs(mstart, it),
                        {
-                               sp = it;
-                               break;
-                       }
+                               if((traceline(mstart, it.origin + (it.mins + it.maxs) * 0.5, MOVE_NORMAL, e), trace_fraction) >= 1)
+                               {
+                                       sp = it;
+                                       break;
+                               }
  
-                       ++items_checked;
-                       if(items_checked >= attempts)
-                               break; // sanity
-               });
+                               ++items_checked;
+                               if(items_checked >= attempts)
+                                       break; // sanity
+                       });
  
-               if(!sp)
-                       continue;
-       }
+                       if(!sp)
+                               continue;
+               }
  
          // find a random vector to "look at"
          end.x = org.x + random() * delta.x;
      {
          setorigin(e, start);
          e.angles = vectoangles(end - start);
-         LOG_DEBUG("Needed ", ftos(i + 1), " attempts");
+         LOG_DEBUG("Needed ", ftos(j + 1), " attempts");
          return true;
      }
-     else
-         return false;
+     return false;
  }
  
 -float MoveToRandomMapLocation(entity e, float goodcontents, float badcontents, float badsurfaceflags, float attempts, float maxaboveground, float minviewdistance)
 +bool MoveToRandomMapLocation(entity e, float goodcontents, float badcontents, float badsurfaceflags, int attempts, float maxaboveground, float minviewdistance)
  {
 -      return MoveToRandomLocationWithinBounds(e, world.mins, world.maxs, goodcontents, badcontents, badsurfaceflags, attempts, maxaboveground, minviewdistance);
 +      return MoveToRandomLocationWithinBounds(e, world.mins, world.maxs, goodcontents, badcontents, badsurfaceflags, attempts, maxaboveground, minviewdistance, false);
  }
  
  void write_recordmarker(entity pl, float tstart, float dt)
Simple merge