Merge branch 'master' into terencehill/glowmod_color_fix
authorMario <mario.mario@y7mail.com>
Sun, 18 Oct 2020 22:22:49 +0000 (08:22 +1000)
committerMario <mario.mario@y7mail.com>
Sun, 18 Oct 2020 22:22:49 +0000 (08:22 +1000)
1  2 
qcsrc/client/csqcmodel_hooks.qc
qcsrc/client/weapons/projectile.qc
qcsrc/common/turrets/cl_turrets.qc
qcsrc/common/weapons/all.qh

index 41217ca4cc5e233425a4c50e730d859a137339e4,3adef84a4b5c72299ba8f8c5889013c0bd145833..6a31b85bc5e8af537364f41b5e6c4d4deeacb7ce
@@@ -1,15 -1,18 +1,18 @@@
  #include "csqcmodel_hooks.qh"
- #include "autocvars.qh"
- #include "miscfunctions.qh"
+ #include <client/autocvars.qh>
  #include <client/mutators/_mod.qh>
- #include "player_skeleton.qh"
- #include "weapons/projectile.qh"
+ #include <client/player_skeleton.qh>
+ #include <client/weapons/projectile.qh>
  #include <common/animdecide.qh>
+ #include <common/effects/all.inc>
+ #include <common/effects/all.qh>
  #include <common/ent_cs.qh>
+ #include <common/gamemodes/_mod.qh>
+ #include <common/mapinfo.qh>
  #include <common/physics/movetypes/movetypes.qh>
+ #include <common/physics/player.qh>
  #include <common/viewloc.qh>
- #include <common/effects/all.qh>
- #include <common/effects/all.inc>
  #include <lib/csqcmodel/cl_model.qh>
  #include <lib/csqcmodel/cl_player.qh>
  #include <lib/csqcmodel/interpolate.qh>
@@@ -133,6 -136,9 +136,9 @@@ void CSQCPlayer_ModelAppearance_PostUpd
  }
  void CSQCPlayer_ModelAppearance_Apply(entity this, bool islocalplayer)
  {
+       int cm = this.forceplayermodels_savecolormap;
+       cm = (cm >= 1024) ? cm : (entcs_GetClientColors(cm - 1) + 1024);
        if(MUTATOR_CALLHOOK(ForcePlayermodels_Skip, this, islocalplayer))
                goto skipforcemodels;
  
  
        // apply it
        bool isfriend;
-       int cm;
-       cm = this.forceplayermodels_savecolormap;
-       cm = (cm >= 1024) ? cm : (entcs_GetClientColors(cm - 1) + 1024);
  
        if(teamplay)
                isfriend = (cm == 1024 + 17 * myteam);
                this.skin = this.forceplayermodels_saveskin;
        }
  
+       LABEL(skipforcemodels)
+       if(MUTATOR_CALLHOOK(ForcePlayercolors_Skip, this, islocalplayer))
+               goto skipforcecolors;
        // forceplayercolors too
        if(teamplay)
        {
  
                if(autocvar_cl_forcemyplayercolors)
                        forcecolor_friend = 1024 + autocvar_cl_forcemyplayercolors;
-               if(autocvar_cl_forceplayercolors == 2 && team_count == 2)
+               if((autocvar_cl_forceplayercolors == 2 && team_count == 2)
+                       || (autocvar_cl_forceplayercolors == 3 && IS_GAMETYPE(DUEL)))
                        forcecolor_enemy = 1024 + autocvar__cl_color;
  
                if(forcecolor_enemy && !forcecolor_friend)
                        this.colormap = player_localnum + 1;
        }
  
-       LABEL(skipforcemodels)
+       LABEL(skipforcecolors)
  
        if((this.csqcmodel_effects & CSQCMODEL_EF_RESPAWNGHOST) && !autocvar_cl_respawn_ghosts_keepcolors)
        {
  
        // 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';
  
@@@ -414,7 -423,7 +423,7 @@@ void CSQCModel_AutoTagIndex_Apply(entit
                }
  
                // recursive predraw call to fix issues with forcemodels and LOD if bone indexes mismatch
-               if(this.tag_entity.classname == "csqcmodel")
+               if(this.tag_entity.classname == "ENT_CLIENT_MODEL")
                {
                        CSQCModel_Hook_PreDraw(this.tag_entity, (this.tag_entity.isplayermodel & ISPLAYER_CLIENT));
                }
@@@ -520,9 -529,15 +529,15 @@@ void CSQCModel_Effects_Apply(entity thi
        if(eff & EF_FULLBRIGHT)
                this.renderflags |= RF_FULLBRIGHT;
        if(eff & EF_FLAME)
-               pointparticles(EFFECT_EF_FLAME, this.origin, '0 0 0', bound(0, frametime, 0.1));
+       {
+               boxparticles(particleeffectnum(EFFECT_EF_FLAME), this, this.absmin, this.absmax, this.velocity, this.velocity, bound(0, frametime, 0.1), 0);
+               //pointparticles(EFFECT_EF_FLAME, this.origin, '0 0 0', bound(0, frametime, 0.1));
+       }
        if(eff & EF_STARDUST)
-               pointparticles(EFFECT_EF_STARDUST, this.origin, '0 0 0', bound(0, frametime, 0.1));
+       {
+               boxparticles(particleeffectnum(EFFECT_EF_STARDUST), this, this.absmin, this.absmax, this.velocity, this.velocity, bound(0, frametime, 0.1), 0);
+               //pointparticles(EFFECT_EF_STARDUST, this.origin, '0 0 0', bound(0, frametime, 0.1));
+       }
        if(eff & EF_NOSHADOW)
                this.renderflags |= RF_NOSHADOW;
        if(eff & EF_NODEPTHTEST)
index c16e7b809fbb869b58de3fdc6a5e1423a063033b,6e4903f4d9648598df27fea9104ef81e3a7d5754..a8cdcf90c5724877f25a045e16dcb25800eeaae4
@@@ -1,20 -1,14 +1,14 @@@
  #include "projectile.qh"
  
- #include "../autocvars.qh"
- #include "../defs.qh"
- #include "../main.qh"
+ #include <client/autocvars.qh>
  #include <client/mutators/_mod.qh>
  #include <common/constants.qh>
- #include <common/effects/effect.qh>
  #include <common/effects/all.qh>
+ #include <common/effects/effect.qh>
+ #include <common/mutators/mutator/nades/nades.qh>
  #include <common/net_linked.qh>
  #include <common/physics/movetypes/movetypes.qh>
- #include <common/mutators/mutator/nades/nades.qh>
  #include <lib/csqcmodel/interpolate.qh>
  #include <lib/warpzone/anglestransform.qh>
  
  .float alpha;
@@@ -282,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
        if (!(this.count & 0x80))
                InterpolateOrigin_Note(this);
  
-       this.classname = "csqcprojectile";
        this.draw = Projectile_Draw;
        if (isnew) IL_PUSH(g_drawables, this);
        this.entremove = Ent_RemoveProjectile;
index da67dd7a7ced2cf356a64772edde3cc8e3a64230,84812fc4605cb2d34fb8497b975e1b9b7d6bafa3..5c309ece8012806f50245ee1583f6d991c880cbe
@@@ -1,4 -1,5 +1,5 @@@
  #include "cl_turrets.qh"
  void turret_remove(entity this)
  {
        delete(this.tur_head);
@@@ -9,7 -10,7 +10,7 @@@
  .vector glowmod;
  void turret_changeteam(entity this)
  {
 -      this.glowmod = Team_ColorRGB(this.team - 1) * 2;
 +      this.glowmod = Team_ColorRGB(this.team - 1);
        this.teamradar_color = Team_ColorRGB(this.team - 1);
  
        if(this.team)
@@@ -376,8 -377,7 +377,7 @@@ NET_HANDLE(ENT_CLIENT_TURRET, bool isne
                this.origin = ReadVector();
                setorigin(this, this.origin);
  
-               this.angles_x = ReadAngle();
-               this.angles_y = ReadAngle();
+               this.angles = ReadAngleVector2D();
  
                turret_construct(this, isnew);
                this.colormap = 1024;
index c980dc64f568441b1ad46bbca62b1fcbae7dc1df,2a7ed0bebbc46a8764d35722b3b0a4cce05d70b0..6e63832d3c9433d0bbe030fd70b7fb543aab3e4b
@@@ -20,6 -20,7 +20,7 @@@ WepSet ReadWepSet()
  #include "calculations.qh"
  #include "projectiles.qh"
  #include <common/models/all.qh>
+ #include <common/effects/all.qh>
  #endif
  
  #include <common/util.qh>
@@@ -81,10 -82,10 +82,10 @@@ GENERIC_COMMAND(dumpweapons, "Dump all 
          default:
          case CMD_REQUEST_USAGE:
          {
-             LOG_INFO("Usage:^3 ", GetProgramCommandPrefix(), " dumpweapons [filename]");
-             LOG_INFO("  Where 'filename' is the file to write (default is weapons_dump.cfg),");
-             LOG_INFO("  if supplied with '-' output to console as well as default,");
-             LOG_INFO("  if left blank, it will only write to default.");
+             LOG_HELP("Usage:^3 ", GetProgramCommandPrefix(), " dumpweapons [filename]");
+             LOG_HELP("  Where 'filename' is the file to write (default is weapons_dump.cfg),");
+             LOG_HELP("  if supplied with '-' output to console as well as default,");
+             LOG_HELP("  if left blank, it will only write to default.");
              return;
          }
      }
@@@ -291,6 -292,7 +292,7 @@@ const .float reloading_time = reload_ti
  
  
  // read cvars from weapon settings
+ // cvars are created as such: g_balance_wepname_name
  #define WEP_CVAR(wepname, name) (_wep_##wepname.wepvar_##name)
  #define WEP_CVAR_PRI(wepname, name) WEP_CVAR(wepname, primary_##name)
  #define WEP_CVAR_SEC(wepname, name) WEP_CVAR(wepname, secondary_##name)
@@@ -327,7 -329,7 +329,7 @@@ STATIC_INIT(register_weapons_done
          else
                inaccessible = strcat(inaccessible, "\n", it.netname);
      });
-     if (inaccessible) LOG_TRACEF("Impulse limit exceeded, weapon(s) will not be directly accessible: %s", inaccessible);
+     if (inaccessible && autocvar_developer > 0) LOG_TRACEF("Impulse limit exceeded, weapon(s) will not be directly accessible: %s", inaccessible);
      #ifdef CSQC
      FOREACH(Weapons, true, it.wr_init(it));
      #endif
  vector weaponentity_glowmod(Weapon wep, entity actor, int c, entity wepent)
  {
      vector g;
 -    if (!(g = wep.wr_glow(wep, actor, wepent))) g = colormapPaletteColor(c & 0x0F, true) * 2;
 +    if (!(g = wep.wr_glow(wep, actor, wepent))) g = colormapPaletteColor(c & 0x0F, true);
      return g;
  }
  
  
  .vector spawnorigin; // for casings
  
+ .vector movedir_aligned; // shot origin based on weapon alignment (unaffected by shootfromeye)
  // weapon animation vectors:
  .vector anim_fire1;
  .vector anim_fire2;
  .vector anim_idle;
  .vector anim_reload;
  
+ .entity muzzle_flash;
  // static frame globals
  
  ENUMCLASS(WFRAME)
@@@ -394,4 -400,8 +400,8 @@@ REPLICATE(cvar_cl_accuracy_data_receive
  #ifdef SVQC
  void wframe_send(entity actor, entity weaponentity, int wepframe, float attackrate, bool restartanim);
  #endif
+ #ifdef SVQC
+ void W_MuzzleFlash(Weapon thiswep, entity actor, .entity weaponentity, vector shotorg, vector shotdir);
+ #endif
  #endif