]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Merge branch 'terencehill/vec2_optimizations' into 'master'
authorMario <zacjardine@y7mail.com>
Sun, 25 Jun 2017 09:08:00 +0000 (09:08 +0000)
committerMario <zacjardine@y7mail.com>
Sun, 25 Jun 2017 09:08:00 +0000 (09:08 +0000)
vec2 optimizations

See merge request !448

1  2 
qcsrc/client/hud/hud.qc
qcsrc/client/hud/hud.qh
qcsrc/common/weapons/weapon/tuba.qc

diff --combined qcsrc/client/hud/hud.qc
index fd46288c6779420d09f9d9e62d9b032c7ef16696,ad7f83fa92b80a2d5be6e7e27507c33fbd02bf01..f6469a58b429dbbb1c7bff6f0b1702f4f6d45273
@@@ -109,10 -109,7 +109,7 @@@ vector HUD_GetTableSize_BestItemAR(int 
                rows = ceil(item_count/columns);
        }
  
-       if(vertical)
-               return eX * best_rows + eY * best_columns;
-       else
-               return eX * best_columns + eY * best_rows;
+       return (vertical) ? vec2(best_rows, best_columns) : vec2(best_columns, best_rows);
  }
  
  /*
@@@ -490,9 -487,8 +487,9 @@@ void calc_followmodel_ofs(entity view)
  void Hud_Dynamic_Frame()
  {
        vector ofs = '0 0 0';
 -      hud_scale = '1 1 0';
 -      hud_shift = '0 0 0';
 +      hud_scale_current = '1 1 0';
 +      hud_shift_current = '0 0 0';
 +
        if (autocvar_hud_dynamic_follow)
        {
                entity view = CSQCModel_server2csqc(player_localentnum - 1);
                ofs.y = bound(-0.1, ofs.y, 0.1);
                ofs.z = bound(-0.1, ofs.z, 0.1);
  
 -              hud_shift.x = ofs.y * vid_conwidth;
 -              hud_shift.y = ofs.z * vid_conheight;
 -              hud_shift.z = ofs.x;
 +              hud_shift_current.x = ofs.y * vid_conwidth;
 +              hud_shift_current.y = ofs.z * vid_conheight;
 +              hud_shift_current.z = ofs.x;
  
 -              hud_scale.x = (1 + hud_shift.z);
 -              hud_scale.y = hud_scale.x;
 +              hud_scale_current.x = (1 + hud_shift_current.z);
 +              hud_scale_current.y = hud_scale_current.x;
        }
  
        if(autocvar_hud_dynamic_shake > 0)
  
                if(hud_dynamic_shake_factor > 0)
                {
 -                      hud_shift.x += hud_dynamic_shake_realofs.x;
 -                      hud_shift.y += hud_dynamic_shake_realofs.y;
 +                      hud_shift_current.x += hud_dynamic_shake_realofs.x;
 +                      hud_shift_current.y += hud_dynamic_shake_realofs.y;
                }
        }
  
        hud_scale_center.x = 0.5 * vid_conwidth;
        hud_scale_center.y = 0.5 * vid_conheight;
  
 -      hud_scale_current = hud_scale;
 -      hud_shift_current = hud_shift;
 +      HUD_Scale_Disable();
  }
  
  void HUD_Main()
diff --combined qcsrc/client/hud/hud.qh
index 444b33ec445db4e0cc82e3d459b7c7b0cc32bdb7,aa8b626543e6d0e76813f6da3f7ed663a03ee15b..467a5b33b9f5c23f67ea80dc46b8595c8074629d
@@@ -169,9 -169,9 +169,9 @@@ vector cl_followmodel_ofs
  float cl_followmodel_time;
  
  vector hud_scale;
 -vector hud_scale_current;
 +vector hud_scale_current = '1 1 0';
  vector hud_shift;
 -vector hud_shift_current;
 +vector hud_shift_current = '0 0 0';
  vector hud_scale_center;
  
  float stringwidth_colors(string s, vector theSize);
@@@ -356,7 -356,7 +356,7 @@@ REGISTER_HUD_PANEL(SCOREBOARD,      Sco
                new_size.x = max_panel_width; \
                new_size.y = panel_size.y * (new_size.x / panel_size.x); \
        } \
-       vector new_pos = eX * (panel_bg_border + 0.5 * max_panel_width) + eY * 0.5 * vid_conheight - 0.5 * new_size; \
+       vector new_pos = vec2(panel_bg_border + 0.5 * max_panel_width, 0.5 * vid_conheight) - 0.5 * new_size; \
        panel_pos = (1 - autocvar__menu_alpha) * panel_pos + (autocvar__menu_alpha) * new_pos; \
        panel_size = (1 - autocvar__menu_alpha) * panel_size + (autocvar__menu_alpha) * new_size; \
  } MACRO_END
index 652534b7a28d05e47fbf21668a16170967db440b,306842e784996524e19c0a17676537e3ebeb390b..ef3c4dc83ccfeb798396159ea4c2d3beba3226c8
@@@ -2,7 -2,7 +2,7 @@@
  #ifndef IMPLEMENTATION
  CLASS(Tuba, Weapon)
  /* impulse   */ ATTRIB(Tuba, impulse, int, 1);
 -/* flags     */ ATTRIB(Tuba, spawnflags, int, WEP_FLAG_HIDDEN | WEP_TYPE_SPLASH);
 +/* flags     */ ATTRIB(Tuba, spawnflags, int, WEP_FLAG_HIDDEN | WEP_TYPE_SPLASH | WEP_FLAG_NODUAL);
  /* rating    */ ATTRIB(Tuba, bot_pickupbasevalue, float, 2000);
  /* color     */ ATTRIB(Tuba, wpcolor, vector, '0 1 0');
  /* modelname */ ATTRIB(Tuba, mdl, string, "tuba");
@@@ -157,7 -157,7 +157,7 @@@ void W_Tuba_NoteOff(entity this
        if (actor.(weaponentity).tuba_note == this)
        {
                actor.(weaponentity).tuba_lastnotes_last = (actor.(weaponentity).tuba_lastnotes_last + 1) % MAX_TUBANOTES;
-               actor.(weaponentity).(tuba_lastnotes[actor.(weaponentity).tuba_lastnotes_last]) = eX * this.spawnshieldtime + eY * time + eZ * this.cnt;
+               actor.(weaponentity).(tuba_lastnotes[actor.(weaponentity).tuba_lastnotes_last]) = vec3(this.spawnshieldtime, time, this.cnt);
                actor.(weaponentity).tuba_note = NULL;
                actor.(weaponentity).tuba_lastnotes_cnt = bound(0, actor.(weaponentity).tuba_lastnotes_cnt + 1, MAX_TUBANOTES);