Community made patches and improvements

Developer discussion of experimental fixes, changes, and improvements.

Moderators: Nexuiz Moderators, Moderators

Postby esteel » Thu Jan 15, 2009 6:04 pm

Well i think it should be easy for you to take to code from here: http://forums.alientrap.local/viewtopic.php?p=52190#52190 and adjust it to your current code as I do not have the nex sources avavilable right now.
esteel
Site admin and forum addon
 
Posts: 3924
Joined: Wed Mar 01, 2006 8:27 am

Postby MirceaKitsune » Thu Jan 15, 2009 6:56 pm

Done, now the non-custom crosshair uses the older cvars. I also renamed the switch to cl_per_weapon_crosshairs as you said in an earlier post, as that is indeed the most descriptive name possible. Patch HERE and HERE. Now I really think this patch is ready to go in :)
Last edited by MirceaKitsune on Thu Jan 15, 2009 8:53 pm, edited 1 time in total.
MirceaKitsune
Keyboard killer
 
Posts: 593
Joined: Thu Aug 14, 2008 6:48 am
Location: Romania - Bucharest

Postby esteel » Thu Jan 15, 2009 7:19 pm

Looks better now, however:

Code: Select all
-192,6 +191,10 @@
float view_set;
float camera_mode;
vector camera_offset, current_origin, mouse_angles, current_camera_offset, new_angles;
+
+string wcross_wep;
+float wcross_alpha, wcross_style, wcross_custom;
+vector wcross_color, wcross_size;
void CSQC_UpdateView(float w, float h)
{
   entity e;
-295,9 +298,26 @@
   }

   if(last_weapon != activeweapon) {
+      :wcross_recheck
+      wcross_custom = cvar("cl_per_weapon_crosshairs");
+      if(!wcross_custom)
+         wcross_wep = "normal";
+      else {
+         e = get_weaponinfo(activeweapon);
+         wcross_wep = e.netname;
+      }
      weapontime = time;
      last_weapon = activeweapon;
   }
+   if(wcross_custom != cvar("crosshair_custom"))
+      goto wcross_recheck;
+   wcross_style = cvar(strcat("crosshair_", wcross_wep));
+   wcross_color_x = cvar(strcat("crosshair_", wcross_wep, "_color_red"));
+   wcross_color_y = cvar(strcat("crosshair_", wcross_wep, "_color_green"));
+   wcross_color_z = cvar(strcat("crosshair_", wcross_wep, "_color_blue"));
+   wcross_size_x = cvar(strcat("crosshair_", wcross_wep, "_size")) * 24;
+   wcross_size_y = cvar(strcat("crosshair_", wcross_wep, "_size")) * 24;
+   wcross_alpha = cvar(strcat("crosshair_", wcross_wep, "_color_alpha"));


Why do the stuff within if(last_weapon != activeweapon) ? if you move the code to an better place you can make it simpler, easier to understand and less error prone.

I'do it like this:
Code: Select all
-295,9 +298,26 @@
   }

   if(last_weapon != activeweapon) {
      weapontime = time;
      last_weapon = activeweapon;
   }
+   string wcross_wep; // strings are "" on init (do not keep this comment :P )
+   float wcross_alpha, wcross_style;
+   vector wcross_color, wcross_size;
+   if(cvar("crosshair_per_weapon"))
+      e = get_weaponinfo(activeweapon);
+      wcross_wep = e.netname;
+   }
+   wcross_style = cvar(strcat("crosshair_", wcross_wep));
+   wcross_color_x = cvar(strcat("crosshair_", wcross_wep, "_color_red"));
+   wcross_color_y = cvar(strcat("crosshair_", wcross_wep, "_color_green"));
+   wcross_color_z = cvar(strcat("crosshair_", wcross_wep, "_color_blue"));
+   wcross_size_x = cvar(strcat("crosshair_", wcross_wep, "_size")) * 24;
+   wcross_size_y = wcross_size_x;
+   wcross_alpha = cvar(strcat("crosshair_", wcross_wep, "_color_alpha"));


That reduces the code, removes all global variables, gets rid of the update problem, makes it easier to read and i doubt its slower. It also does away that strzone which did not have had an matching strunzone (basicly a memory leak..) because the string is only used locally. I'd also name this cvar just 'crosshair_per_weapon' its shorter and IMO closer to the other cvars and acutally enables people to find it by chance via tab completion when changing the variables from the console..

The menu changes are a bit mood as long as there is no menu to change all the settings. Maybe you can take a look at how the radar & waypoint or weapon-priority 'sub window' is done and move/add all the crosshair stuff into a "crosshair window", so you have the current settings and per gun in the window?
esteel
Site admin and forum addon
 
Posts: 3924
Joined: Wed Mar 01, 2006 8:27 am

Postby MirceaKitsune » Thu Jan 15, 2009 9:02 pm

Done what you said above except the menus. The reason I was keeping everything in that if(last_weapon != activeweapon) statement was that I was being too careful to only execute what was necessary every frame, but now that I look again that was pointless and it doesn't cause any harm this way and makes things much better. Re-check the links in my post above for new patch location.

The menus have a longer story. My initial idea was putting the crosshair selector left of the priority list in the Weapons window as well, and when weapon based crosshairs were in use have the weapon you select in the priority list be the one the crosshair selectors adjust for (see this illustration I made a while ago). That would require heavy coding however, so unless we can get something like that working there's no point in moving the crosshair selector from Player Setup and just leaving that toggle checkbox for the cvar is good for now. Besides, moving them would leave Player Setup very deserted as well so for now I think the menu should be applied like this and later on we may look at a way to get stuff working like in that picture I linked.
MirceaKitsune
Keyboard killer
 
Posts: 593
Joined: Thu Aug 14, 2008 6:48 am
Location: Romania - Bucharest

Postby esteel » Thu Jan 15, 2009 10:15 pm

I think its good enough for now, i changed it slightly and did commit this: http://pastebin.com/d34572c9d
The menu is however sub optimal and needs further changes!

I think the menu change you propose would not even be that much/hard to code. For example the server list has some similar dependencies. I'm just not sure if its a good way to present those settings. Its not really clear that you have to click the list to set the weapons crosshair. Maybe it would help to exchange the left/right parts and move the crosshair stuff lower so that the dependency is easier to see/feel. Maybe i find some time during the weekend for those menu changes, please say something in case you also try your luck at them.

I think all that would be needed is to turn the complete crosshair stuff into a own control (like the weaponslist itself) and the weaponslist would need an entity 'pointer' to this control. In the lists onclick method you would then tell the CH control which weapon was clicked and it would check the per_weapon setting and if enabled then basicly load the right values (much like the drawing code does now) and displays them. Does not sound hard..
Last edited by esteel on Thu Jan 15, 2009 10:36 pm, edited 1 time in total.
esteel
Site admin and forum addon
 
Posts: 3924
Joined: Wed Mar 01, 2006 8:27 am

Postby MirceaKitsune » Thu Jan 15, 2009 10:34 pm

Thanks a lot for committing it, I feel relieved to finally see it applied :) I will let you know if I manage to get anything regarding the menus working, they do indeed need better changes although I don't think I can do something that big at my level of knowledge.

My belief is that the Weapon Setup window is the best place for the crosshair settings to be at. There's no reason to make a new window just for the crosshairs... in this form crosshairs are kind of a weapon property and I think their place is surely there. The weapon priority list would be the best thing to set them from, it would be pointless to make a new weapon list somewhere else just for the crosshairs rather then using the same one for many purposes. The weapon you have select in the priority list would be the one the adjusters would adjust the crosshair for.

We would find ways to somehow indicate that what you select in the priority list influences the weapon crosshairs... or people would figure it out by theirselves. Also later on, every weapon you select in the priority list (which by the way should probably be renamed to "Weapon List" as it would serve many purposes) should display a nice looking picture like an avatar of the weapon with a short description of it in the window. That would look beautiful I think, although a bit later on :)
MirceaKitsune
Keyboard killer
 
Posts: 593
Joined: Thu Aug 14, 2008 6:48 am
Location: Romania - Bucharest

Postby MirceaKitsune » Fri Jan 16, 2009 2:17 am

Anyway I couldn't resist making a few more changes for today about 3 more things I had on my list. I fixed a small menu arrangement in Audio and I also attempted to change two firing types which I wanted to propose here (been planning to do this for a short while).

The first firing type I wanted to change was the hagar's alt fire, because after testing a bit I noticed that the bouncing rockets are hardly able to hit and that firing type is completely useless for the hagar. I changed the hagar's firing type in this patch so instead of bouncing rockets it sends faster spread rockets but with less damage... probably not the best idea but as I said I thought it would be important to have a firing type which can actually hit someone. My initial wish was to make it shoot 5 spread rockets in a row like a shotgun with a refiring rate of probably 2-3 seconds, but I couldn't do that so I thought this could be useful for now. Certainly no one used this firing type until now so no one would likely miss it, but I dunno.

The second firing type I changed was the crylink's alt fire which I made a bit more spread. It was hard to hit with it at close range and in general so this new spread should make its firing type a bit more useful at average distances I think. Patch HERE and HERE.
MirceaKitsune
Keyboard killer
 
Posts: 593
Joined: Thu Aug 14, 2008 6:48 am
Location: Romania - Bucharest

Postby esteel » Fri Jan 16, 2009 8:40 am

Actually the weapons are quite nicely balanced at the moment and changes to them would need proper testing which can take a lot of time. The hagar secondary is not so much a firemode to attack with but to help you control or clean out certain spots (as you can shoot around the corner) i'm not sure if it should be changed at all but if so then i'm against changing it into something too similar to existing stuff (both the shotgun and crylink primary have 'shotgun patterns')
As for the crylink secondary, i think currently it hits the sweet spot were the primary firemode can be too hard to hit at mid range due to peoples movement but the secondary will be quite easy to hit. If we were to raise the spread it would do less damage at this range and i think that would be bad.

I'll see to start with the crosshair menu changes later the day..
esteel
Site admin and forum addon
 
Posts: 3924
Joined: Wed Mar 01, 2006 8:27 am

Postby MirceaKitsune » Fri Jan 16, 2009 11:45 am

Yeah these changes were probably too quick and not as helpful as I thought. As an idea, maybe the hagar alt. fire could send rockets which bounce but when they hit the place they bounce from they also explode there as well (hit the the surface, explode there like normal hagar fire but the rocket continues one more time and explodes disappearing in the next surface). As for the crylink's, it still acts a bit like a sniper I think (aim carefully and hit well in the right spot), but it is usable and good I guess.

Anyway I updated and love the menu changes you made for now. A separate checkbox for crosshair colors is a great idea, as I seen some games which have custom crosshairs but the color stays the same (of course everything should be still customizable so yeah). The size and alpha could be global, although I'm not sure if alpha falls under the category of the color or not.

Anyway as you told me to ask you whenever I attempt to make a new change. I'm going to try and move the crosshairs from the latest SVN into the left part of the Weapon Setup window again. I've done it before (still have it in a older patch) so it shouldn't be long... I'll post here when I'm ready if that's ok.
MirceaKitsune
Keyboard killer
 
Posts: 593
Joined: Thu Aug 14, 2008 6:48 am
Location: Romania - Bucharest

Postby MirceaKitsune » Fri Jan 16, 2009 12:27 pm

Ok done it. Moved the crosshair adjusters from the latest rev in the Weapons window left of the weapon list. Patch HERE and HERE. The empty space under the crosshair adjusters is where I said yesterday that an avatar and description of the weapon which is selected from the weapons list should appear as well, which would also make it easier to understand that what you select in that list also adjusts for the crosshairs.

At the moment there's still a small problem in the new adjusters you set up however. With "Per weapon crosshairs" enabled, if you adjust the size or alpha that modifies these settings for each weapons crosshair. That should probably still remain disabled until we can have every adjuster there (the crosshair buttons, size slider, alpha slider, R G B sliders) working for every individual weapon depending on what you have set up.

Also I think the color overrider cvar should be named similar / after the custom crosshair cvar. That one is "crosshair_per_weapon", so the per-weapon-crosshair-color setting should probably be named "crosshair_per_weapon_color" or "crosshair_color_per_weapon" or something similar so it still derives from that.
MirceaKitsune
Keyboard killer
 
Posts: 593
Joined: Thu Aug 14, 2008 6:48 am
Location: Romania - Bucharest

PreviousNext

Return to Nexuiz - Development

Who is online

Users browsing this forum: No registered users and 1 guest

cron