Merge branch 'Mario/monsters' into 'develop'
authorbones_was_here <bones_was_here@xa.org.au>
Sat, 4 Jun 2022 12:43:50 +0000 (12:43 +0000)
committerbones_was_here <bones_was_here@xa.org.au>
Sat, 4 Jun 2022 12:43:50 +0000 (12:43 +0000)
Merge branch Mario/monsters (L merge request)

See merge request xonotic/xonotic-data.pk3dir!1017

1  2 
gamemodes-server.cfg
qcsrc/client/csqcmodel_hooks.qc
qcsrc/client/weapons/projectile.qc
qcsrc/server/world.qc
xonotic-client.cfg

diff --combined gamemodes-server.cfg
index 483b6ea3fb35ab435171bfaee61e012cfa416011,bdac1a2343a0c8f26e2c6f4dd104da313401ad30..318749021fe8d329ae55e6cbb58de4eafb3486ef
@@@ -322,7 -322,7 +322,7 @@@ exec ctfscoring-samual.cf
  // ====================
  set g_cts 0 "CTS: complete the stage"
  set g_cts_selfdamage 1 "0 = disable all selfdamage and falldamage in cts"
 -set g_cts_finish_kill_delay 10 "prevent cheating by running back to the start line, and starting out with more speed than otherwise possible"
 +set g_cts_finish_kill_delay 2 "kill player this many seconds after stage completion to prevent cheating by starting out with more speed than otherwise possible; set it to 0 to not kill or to -1 to kill instantly"
  set g_cts_send_rankings_cnt 15 "send this number of map records to clients"
  set g_cts_removeprojectiles 0 "remove projectiles when the player dies, to prevent using weapons earlier in the stage than intended"
  
@@@ -551,8 -551,6 +551,6 @@@ set g_invasion_monster_count 10 "numbe
  set g_invasion_zombies_only 0 "only spawn zombies"
  set g_invasion_spawn_delay 0.25
  set g_invasion_spawnpoint_spawn_delay 0.5
- set g_invasion_teams 0 "number of teams in invasion (note: use mapinfo to set this)"
- set g_invasion_team_spawns 1 "use team spawns in teamplay invasion mode"
  set g_invasion_type 0 "type of invasion mode - 0: round-based, 1: hunting, 2: complete the stage (note: use mapinfo to set this)"
  
  // ======
index f1f581a83003077e3aa86a83cdb229c80799440f,06cf44bdbd1bf9b30422a59983a6de93919e386d..121af1947a9b256ae2b4e0e7013ea4865db10898
  .int lodmodelindex0;
  .int lodmodelindex1;
  .int lodmodelindex2;
- void CSQCPlayer_LOD_Apply(entity this)
+ void CSQCPlayer_LOD_Apply(entity this, bool isplayer)
  {
+       int detailreduction = ((isplayer) ? autocvar_cl_playerdetailreduction : autocvar_cl_modeldetailreduction);
        // LOD model loading
        if(this.lodmodelindex0 != this.modelindex)
        {
        }
  
        // apply LOD
-       if(autocvar_cl_playerdetailreduction <= 0)
+       if(detailreduction <= 0)
        {
-               if(autocvar_cl_playerdetailreduction <= -2)
+               if(detailreduction <= -2)
                        this.modelindex = this.lodmodelindex2;
-               else if(autocvar_cl_playerdetailreduction <= -1)
+               else if(detailreduction <= -1)
                        this.modelindex = this.lodmodelindex1;
                else
                        this.modelindex = this.lodmodelindex0;
        }
        else
        {
-               float distance = vlen(this.origin - view_origin);
-               float f = (distance * current_viewzoom + 100.0) * autocvar_cl_playerdetailreduction;
+               float distance = vlen(((isplayer) ? this.origin : NearestPointOnBox(this, view_origin)) - view_origin); // TODO: perhaps it should just use NearestPointOnBox all the time, player hitbox can potentially be huge
+               float f = (distance * current_viewzoom + 100.0) * detailreduction;
                f *= 1.0 / bound(0.01, view_quality, 1);
                if(f > autocvar_cl_loddistance2)
                        this.modelindex = this.lodmodelindex2;
@@@ -328,7 -330,7 +330,7 @@@ void CSQCPlayer_ModelAppearance_Apply(e
  
        // GLOWMOD AND DEATH FADING
        if(this.colormap > 0)
 -              this.glowmod = colormapPaletteColor(((this.colormap >= 1024) ? this.colormap : entcs_GetClientColors(this.colormap - 1)) & 0x0F, true) * 2;
 +              this.glowmod = colormapPaletteColor(((this.colormap >= 1024) ? this.colormap : entcs_GetClientColors(this.colormap - 1)) & 0x0F, true);
        else
                this.glowmod = '1 1 1';
  
                }
        }
  
 +      // don't let the engine increase player's glowmod
 +      if (autocvar_r_hdr_glowintensity > 1)
 +              this.glowmod /= autocvar_r_hdr_glowintensity;
 +
        //printf("CSQCPlayer_ModelAppearance_Apply(): state = %s, colormap = %f, glowmod = %s\n", (this.csqcmodel_isdead ? "DEAD" : "ALIVE"), this.colormap, vtos(this.glowmod));
  }
  
@@@ -667,7 -665,7 +669,7 @@@ void CSQCModel_Hook_PreDraw(entity this
        if((this.isplayermodel & ISPLAYER_MODEL) && this.drawmask) // this checks if it's a player MODEL!
        {
                CSQCPlayer_ModelAppearance_Apply(this, (this.isplayermodel & ISPLAYER_LOCAL));
-               CSQCPlayer_LOD_Apply(this);
+               CSQCPlayer_LOD_Apply(this, true);
  
                if(!isplayer)
                {
                        }
                }
        }
+       else
+               CSQCPlayer_LOD_Apply(this, false);
  
        CSQCModel_AutoTagIndex_Apply(this);
  
index 3cfd741a4495382c2ecf7b36b0adb34d7d6f0aef,b4c9f86b2c5f75419196370653e728a59ad9f981..1df65036ec59a83b10feeba19544c818ee939e9a
@@@ -276,7 -276,7 +276,7 @@@ NET_HANDLE(ENT_CLIENT_PROJECTILE, bool 
                // TODO: projectiles use glowmaps for their color, not teams
                #if 0
                if(this.colormap > 0)
 -                      this.glowmod = colormapPaletteColor(this.colormap & 0x0F, true) * 2;
 +                      this.glowmod = colormapPaletteColor(this.colormap & 0x0F, true);
                else
                        this.glowmod = '1 1 1';
                #endif
                        HANDLE(SEEKER)             this.traileffect = EFFECT_SEEKER_TRAIL.m_id; break;
  
                        HANDLE(MAGE_SPIKE)         this.traileffect = EFFECT_TR_VORESPIKE.m_id; break;
-                       HANDLE(SHAMBLER_LIGHTNING) this.traileffect = EFFECT_TR_NEXUIZPLASMA.m_id; break;
+                       HANDLE(GOLEM_LIGHTNING)    this.traileffect = EFFECT_TR_NEXUIZPLASMA.m_id; break;
  
                        HANDLE(RAPTORBOMB)         this.gravity = 1; this.avelocity = '0 0 180'; this.traileffect = EFFECT_Null.m_id; break;
                        HANDLE(RAPTORBOMBLET)      this.gravity = 1; this.avelocity = '0 0 180'; this.traileffect = EFFECT_Null.m_id; break;
                                this.bouncefactor = WEP_CVAR(mortar, bouncefactor);
                                this.bouncestop = WEP_CVAR(mortar, bouncestop);
                                break;
-                       case PROJECTILE_SHAMBLER_LIGHTNING:
+                       case PROJECTILE_GOLEM_LIGHTNING:
                                this.mins = '-8 -8 -8';
                                this.maxs = '8 8 8';
                                this.scale = 2.5;
diff --combined qcsrc/server/world.qc
index 6c2e4a3f71b906f18242bf69ac8220aab0b6d2ab,7e1333eb875a87002ecafca1edcbb85f5df74106..55195217250186bf498db837ac07b236503f3d1b
@@@ -35,6 -35,7 +35,6 @@@
  #include <server/damage.qh>
  #include <server/gamelog.qh>
  #include <server/hook.qh>
 -#include <server/intermission.qh>
  #include <server/ipban.qh>
  #include <server/items/items.qh>
  #include <server/main.qh>
@@@ -45,6 -46,7 +45,6 @@@
  #include <server/scores_rules.qh>
  #include <server/spawnpoints.qh>
  #include <server/teamplay.qh>
 -#include <server/weapons/common.qh>
  #include <server/weapons/weaponstats.qh>
  
  const float LATENCY_THINKRATE = 10;
@@@ -277,7 -279,6 +277,6 @@@ void cvar_changes_init(
                BADCVAR("g_duel_not_dm_maps");
                BADCVAR("g_freezetag");
                BADCVAR("g_freezetag_teams");
-               BADCVAR("g_invasion_teams");
                BADCVAR("g_invasion_type");
                BADCVAR("g_jailbreak");
                BADCVAR("g_jailbreak_teams");
@@@ -842,15 -843,46 +841,15 @@@ spawnfunc(worldspawn
  
        WaypointSprite_Init();
  
 -      GameLogInit(); // prepare everything
        // NOTE for matchid:
        // changing the logic generating it is okay. But:
        // it HAS to stay <= 64 chars
        // character set: ASCII 33-126 without the following characters: : ; ' " \ $
 -      if(autocvar_sv_eventlog)
 -      {
 -              string num = strftime_s(); // strftime(false, "%s") isn't reliable, see strftime_s description
 -              string s = sprintf("%s.%s.%06d", itos(autocvar_sv_eventlog_files_counter), num, floor(random() * 1000000));
 -              matchid = strzone(s);
 -
 -              GameLogEcho(strcat(":gamestart:", GetGametype(), "_", GetMapname(), ":", s));
 -              s = ":gameinfo:mutators:LIST";
 -
 -              MUTATOR_CALLHOOK(BuildMutatorsString, s);
 -              s = M_ARGV(0, string);
 -
 -              // initialiation stuff, not good in the mutator system
 -              if(!autocvar_g_use_ammunition)
 -                      s = strcat(s, ":no_use_ammunition");
 -
 -              // initialiation stuff, not good in the mutator system
 -              if(autocvar_g_pickup_items == 0)
 -                      s = strcat(s, ":no_pickup_items");
 -              if(autocvar_g_pickup_items > 0)
 -                      s = strcat(s, ":pickup_items");
 +      // strftime(false, "%s") isn't reliable, see strftime_s description
 +      matchid = strzone(sprintf("%d.%s.%06d", autocvar_sv_eventlog_files_counter, strftime_s(), random() * 1000000));
  
 -              // initialiation stuff, not good in the mutator system
 -              if(autocvar_g_weaponarena != "0")
 -                      s = strcat(s, ":", autocvar_g_weaponarena, " arena");
 -
 -              // TODO to mutator system
 -              if(autocvar_g_norecoil)
 -                      s = strcat(s, ":norecoil");
 -
 -              GameLogEcho(s);
 -              GameLogEcho(":gameinfo:end");
 -      }
 -      else
 -              matchid = strzone(ftos(random()));
 +      if(autocvar_sv_eventlog)
 +              GameLogInit(); // requires matchid to be set
  
        cvar_set("nextmap", "");
  
@@@ -1000,7 -1032,7 +999,7 @@@ spawnfunc(light
        delete(this);
  }
  
- 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 = e.dphitcontentsmask;
      e.dphitcontentsmask = goodcontents | badcontents;
              continue;
  
                // rule 4: we must "see" some spawnpoint or item
-           entity sp = NULL;
-           IL_EACH(g_spawnpoints, checkpvs(mstart, it),
-           {
-               if((traceline(mstart, it.origin, MOVE_NORMAL, e), trace_fraction) >= 1)
-               {
-                       sp = it;
-                       break;
-               }
-           });
+               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),
+                       {
+                               if((traceline(mstart, it.origin, MOVE_NORMAL, e), trace_fraction) >= 1)
+                               {
+                                       sp = it;
+                                       break;
+                               }
+                       });
+               }
                if(!sp)
                {
                        int items_checked = 0;
  
  float MoveToRandomMapLocation(entity e, float goodcontents, float badcontents, float badsurfaceflags, float 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);
  }
  
  /*
diff --combined xonotic-client.cfg
index f3c5ca7731151c512499a72d3e0d3ac7d3f01611,5fc0578874743dc48e3e9009263d10f6b16e385c..7a0dec6890d33f858326018b9a0c59976989ce15
@@@ -386,6 -386,8 +386,6 @@@ alias weapon_group_7 "impulse 7
  alias weapon_group_8 "impulse 8"
  alias weapon_group_9 "impulse 9"
  alias weapon_group_0 "impulse 14" // cycles the superweapons
 -// TODO: remove after 0.8.2. Default impulse commands for 0.8.1 servers
 -exec weapons.cfg
  
  cl_curl_enabled 1
  cl_curl_maxdownloads 3
@@@ -728,7 -730,7 +728,7 @@@ set menu_updatecheck_getpacks 1 "get up
  seta cl_loddistance1 1024
  seta cl_loddistance2 3072
  seta cl_playerdetailreduction 4       "the higher, the less detailed player models are displayed (LOD)"
- seta cl_modeldetailreduction 1        "the higher, the less detailed certain map models are displayed (LOD)"
+ seta cl_modeldetailreduction 1        "higher values will reduce the detail of non-player and non-weapon models (LOD)"
  
  seta cl_casings_maxcount 100 "maximum amount of shell casings (must be at least 1)"
  seta cl_gibs_maxcount 100 "maximum amount of gibs (must be at least 1)"