Custom Weapon Crosshairs?

Developer discussion of experimental fixes, changes, and improvements.

Moderators: Nexuiz Moderators, Moderators

Postby OSJhA2LEWR » Sat Aug 30, 2008 9:38 am

Logically I'd call it crosshair_independent.

Also, the 55 is made up of ARGB, size, crosshair # variables for the nine weapons, plus your master variable?
OSJhA2LEWR
Newbie
 
Posts: 3
Joined: Sun Aug 24, 2008 8:53 am

Postby Spaceman » Sat Aug 30, 2008 11:31 am

http://217.16.115.15/~blub/nexfiles/?page=file&file=722c6e831db16ac895d45df16ffb7abc

v 0.1 of my crosshair / weapon script

Apply the above patch to a current SVN version of the game engine and add the following to your autoexec.cfg file. Modify it to suit.
//Crosshair Red Green Blue Alpha Size
//0-n, 0-1, 0 - 1, 0 -1, 0 - 1, 0.2 - n

crosshair_toy 1

crosshair1 "51 0 0 1 1 1" // blue, 100% alpha & normal size
crosshair2 "52 0 1 0 1 2" // green, 100% alpha & double size
crosshair3 "53 0 1 1 1 3" // cyan, 100% alpha & triple size
crosshair4 "54 1 0 0 1 4" // red, 100% alpha & quadruple size
crosshair5 "55 1 0 1 1 3" // pink, 100% alpha & triple size
crosshair6 "56 1 1 0 1 2" // yellow, 100% alpha & double size
crosshair7 "57 1 1 1 1 1" // white, 100% alpha & normal size
crosshair8 "58 0 0 0 1 2" // black, 100% alpha & double size
crosshair9 "59 1 1 1 1 0.5" // white, 100% alpha & half size


To do
1) rename crosshair_toy
2) more error checking
3) replace missing info with defaults
4) crosshair_restart
5) rewrite it in QC
Spaceman
Alien trapper
 
Posts: 264
Joined: Tue Aug 28, 2007 10:53 am

Postby divVerent » Sat Aug 30, 2008 12:07 pm

As we have CSQC now, the client knows which crosshair would have to be active, so a failed switch would not change the crosshair the wrong way.

Now... I could implement that feature into CSQC. But there are two ways.

1. Support all your cvars in csqc
2. Make CSQC call an "activeweapon_changed" alias whenever a weapon is switched (and on startup)

Way 2 may be more flexible, but still requires a .cfg for the feature.
1. Open Notepad
2. Paste: ÿþMSMSMS
3. Save
4. Open the file in Notepad again

You can vary the number of "MS", so you can clearly see it's MS which is causing it.
divVerent
Site admin and keyboard killer
 
Posts: 3809
Joined: Thu Mar 02, 2006 4:46 pm
Location: BRLOGENSHFEGLE

Postby MirceaKitsune » Tue Nov 18, 2008 11:32 pm

Are there any news regarding this and possibilities to implement it in the current SVN? Don't know about others but I for one am still very much hoping for this feature to be in sometime. I know from my experience in UT2k4 that custom weapon crosshairs do help a lot, especially with a difference such as a close-range weapons with spread damage vs. long-rage weapons with exact point damage. When using a close-range spread gun like the shotgun you usually want a big round crosshair, while when using something like the nex you'd certainly want a tiny dot or smaller discrete crosshair to hit better. Every weapon fires differently from another, and being able to set your own crosshair depending on how you are best suited with each is something more important then it may seem I believe. Just like equipping your car with different tires when going on an ice covered road then riding on hot summer cement and the other way around... can work without doing it but the car works and handles much better if you do :) Also important when you hide your weapon model as zuriastrad mentioned many posts ago, so you know what weapon you are holding too.

To div's post above even if the reply may be a bit late. Not that much of a "deep developer" to fully understand the difference between the two myself, but I believe some cvars would certainly do good being implemented here and anything woks as long as you can save all separate crosshair configurations for each weapon. A .cfg change would certainly need being done since you'd need to be able to store multiple crosshair settings instead of a single crosshair. From my understanding of the code, the best way is making it so that whenever you switch to a new weapon this also sends an update to the crosshair and loads a different one from the settings, changing the model, size, color and alpha of the cross you customized for that gun.

Just as a question though, this does also plan to accompany a new Player Setup crosshair editor in the menus, right? I think the best way would be to make a new section in the Weapon setup window (the one that you open from the "Weapon settings..." button in the Player Setup menu) and move the crosshair customization there from the Player setup menu it's placed in currently (probably to the left of the weapon priority list). Then when selecting a new weapon from that list the crosshair settings would change and indicate / modify the crosshair for that weapon, and you would set the type colors, size and alpha for each individually. Also there should be a checkbox as to whether or not people want weapon-based crosshairs so we don't force it on those who don't want to either. So if that's doable, will it be that way? Posted an ugly modded screenshot below of how I personally believe the menu should be like exactly. Anyway I hope to see more on this in the future if it's still being worked on :D Hope lots it will work now.

ImageImage
MirceaKitsune
Keyboard killer
 
Posts: 593
Joined: Thu Aug 14, 2008 6:48 am
Location: Romania - Bucharest

Postby Spaceman » Sun Dec 07, 2008 7:52 pm

I did finish the crosshair / weapon script, but it was a modification of the Darkplaces game engine not Nexuiz CSQC. Nexuiz now has the potential for 23 weapons which means a huge number of variables to work with. I currently don't know how to convert the following from C to QC
Code: Select all
while (COM_ParseToken_Simple(&qwer1, true, false))
+   {
+      a = atof(com_token);
+      crosshair_n[j][i] = a;
+      i++;
+   }

Then I need to find some efficient way to store all the crosshair info, probably a big array
Code: Select all
float crosshair_n[22][6];

DivVerent's idea of using aliases seems a better way to do it. I also gave up because the original poster failed to reply.

Your new menu window is good idea, but I would like to see a weapon window. Featuring a picture and a description of each weapon, plus an option to select a crosshair (and size, colour etc) or use the default. As well as changing the weapon priority.
Spaceman
Alien trapper
 
Posts: 264
Joined: Tue Aug 28, 2007 10:53 am

Postby MirceaKitsune » Sun Dec 07, 2008 7:55 pm

victim wrote:I did finish the crosshair / weapon script, but it was a modification of the Darkplaces game engine not Nexuiz CSQC. Nexuiz now has the potential for 23 weapons which means a huge number of variables to work with. I currently don't know how to convert the following from C to QC
Code: Select all
while (COM_ParseToken_Simple(&qwer1, true, false))
+   {
+      a = atof(com_token);
+      crosshair_n[j][i] = a;
+      i++;
+   }

Then I need to find some efficient way to store all the crosshair info, probably a big array
Code: Select all
float crosshair_n[22][6];

DivVerent's idea of using aliases seems a better way to do it. I also gave up because the original poster failed to reply.

Your new menu window is good idea, but I would like to see a weapon window. Featuring a picture and a description of each weapon, plus an option to select a crosshair (and size, colour etc) or use the default. As well as changing the weapon priority.


Any method for a crosshair system is good as long as it works correctly and doesn't cause bugs I believe :) And +1 for the menu idea, I fully agree. Basically the current weapons menu does all that just that it doesn't have a picture and description of each weapon in part. Adding that would make the menu you mentioned come true.
MirceaKitsune
Keyboard killer
 
Posts: 593
Joined: Thu Aug 14, 2008 6:48 am
Location: Romania - Bucharest

Postby Ed » Sun Dec 07, 2008 10:23 pm

zuriastrad wrote:i like to play without the weapon model so weapon specific crosshairs sound like a nice idea to me.

r_drawviewmodel "0"
(in case someone asks)

This may seem like the stupidest question ever, but if you're not able to identify the weapon you're using, shouldn't you play with the view model on? Fixed. :wink:
Ed
Forum addon
 
Posts: 1172
Joined: Wed Mar 01, 2006 12:32 am
Location: UK

Postby MirceaKitsune » Sun Dec 07, 2008 10:36 pm

Ed wrote:
zuriastrad wrote:i like to play without the weapon model so weapon specific crosshairs sound like a nice idea to me.

r_drawviewmodel "0"
(in case someone asks)

This may seem like the stupidest question ever, but if you're not able to identify the weapon you're using, shouldn't you play with the view model on? Fixed. :wink:


Just for the info, I made a menu patch a few weeks ago which got applied and now you can turn the weapon model on or off from Player Setup -> Weapons... under the weapon priority list.
MirceaKitsune
Keyboard killer
 
Posts: 593
Joined: Thu Aug 14, 2008 6:48 am
Location: Romania - Bucharest

Postby MirceaKitsune » Fri Jan 09, 2009 12:18 pm

Thought to post this here as well. I have found a way to implement most of the necessary code for this feature and created a patch which allows custom weapon crosshairs to work as they should, although the patch is still pretty unoptimized and doesn't yet have a menu setting. The patch can be found in THIS POST. If someone can get the crosshair selector in the menus working with this I believe this can be implemented in SVN.
MirceaKitsune
Keyboard killer
 
Posts: 593
Joined: Thu Aug 14, 2008 6:48 am
Location: Romania - Bucharest

Previous

Return to Nexuiz - Development

Who is online

Users browsing this forum: No registered users and 1 guest

cron