Community made patches and improvements

Developer discussion of experimental fixes, changes, and improvements.

Moderators: Nexuiz Moderators, Moderators

Postby divVerent » Tue Jan 13, 2009 6:51 am

We don't NEED a menu chooser, I'd actually prefer new crosshair images made specifically for the weapons, so one can recognize the weapons by it.

Laser: a "star" shape (eight or six lines converging at the center)

Shotgun would e.g. be something circly.

MG a cross with slightly emphasized end points (to symbolize that the MG does spread).

Mortar could be some oval that's higher than wide (to symbolize the grenade a little).

Electro woulld be a small circle with some rays going out of it (like the electro secondary projectile).

Crylink - three lines from the center, going up, 120 degrees from that left, 120 degrees from that right (as that's where the primary particles will go).

Nex - a dot in the center, a small thin circle around it, a larger thin circle around that.

Hagar - a circle with three vertical lines in it, symbolizing the fast rocket firing.

Rocket Launcher - circle with a X in it (as rockets tend to have such "wings")

Porto - a circle, partially red, partially blue. This one uses a targeting laser, and needs no crosshair at all for aiming.

MinstaNex - a +, symbolizing exact aim, with a small circle inside

Seeker - a filled circle like shotgun, with a center dot, and four short lines from the outside into it, symbolizing the homing missiles.

HLAC - a design based on the laser crosshair, but feeling thicker and less exact. Maybe a circle, the 6 "star" lines around it, but the horizontal one going THROUGH the circle and being longer?

Camping Rifle: a + cross, with scales to symbolize exact aim.

It would be ideal if these crosshairs were tuned to match the actual spread of the weapons at the default fov (90), if you can manage that.

The ideas, quickly drawn:

http://emptyset.endoftheinternet.org/~r ... 9624bb.jpg

Note that each crosshair image must contain pixels of two different colors (usually white and black), so it is visible on any background.

Another thing you MUST get rid of before this can go into Nexuiz svn is the overwriting of the crosshair_ cvars. Basically, this means you have to draw the crosshair from csqc code, and not let the engine do it. This is because this cvar is being used by the players for a long time, and this patch is no good reason to break their config because it can be done a better way (csqc). Also, doing a cvar_set every frame is very annoying to people who are debugging stuff, as this prints a message if the developer cvar is high enough (this is also why the v_flipped cvar_set per frame will go shortly before release).
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 C.Brutail » Tue Jan 13, 2009 8:10 am

Please, could there be a checkbox button first? Generally, I don't like when crosshair changes. I know some prefer it, but I think I'm no alone with this.
"One should strive to achieve; not sit in bitter regret."
WE ARE NEXUIZ.
Image
Image
C.Brutail
Laidback mapper
 
Posts: 2357
Joined: Tue Feb 28, 2006 7:26 pm
Location: Ironforge

Postby divVerent » Tue Jan 13, 2009 9:28 am

Sure, I just want it to be ONE checkbox. No need for a chooser for every single weapon.
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 Jan 13, 2009 4:54 pm

I believe that in the ending there should be a way to select crosshairs for each weapon, but probably later on. In UT2004 I tweaked mine for a good while until I got what I was personally suited with and it helped me a lot, so I think this is best as a choosable setting for each gun from the crosshair list. Hard coding crosshairs for each weapon is not something I believe is preferred, so if you keep the cvar system I made they can be edited from the console or the .cfg files which would offer a good way to do that, so no menu chooser would be necessary and the defaults would be settable as cvars for who wishes to change them.

I do perfectly agree that better crosshairs need to be created either way, each of a different type and feel. Also the .tga crosshairs need to be of a higher resolution, as they look ugly and "pixel stretched" when setting them to a size greater then 1 (a double image resolution for crosshairs would be much better looking). I shall look into photoshopping a few myself later on for this patch if it gets applied. And sure C.Brutail, I would have never imagined such a system without a way to turn the weapon based crosshairs on or off. My patch includes the crosshair_custom cvar which does just that.

Actually I have made a new version of the patch which instead just adds this cvar under the crosshair selector. I also disabled it by default so I believe this currently works just as Div intends. For the moment I used the best representing crosshairs for each weapon so it can do it for now until some crosshairs are replaced with better looking ones, when of course I'll do a readjusting. LINK 1 and LINK 2 to new patch. Hope this can work now :)
MirceaKitsune
Keyboard killer
 
Posts: 593
Joined: Thu Aug 14, 2008 6:48 am
Location: Romania - Bucharest

Postby divVerent » Tue Jan 13, 2009 7:33 pm

It still does all that cvar_set stuff, so no.

As for scaling the crosshairs - well, basically, moving the crosshair drawing code to csqc would be the best way for that too. In the engine, a larger crosshair image will make a larger crosshair, while this maybe SHOULD just decide its resolution.
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 Jan 13, 2009 9:29 pm

divVerent wrote:It still does all that cvar_set stuff, so no.

As for scaling the crosshairs - well, basically, moving the crosshair drawing code to csqc would be the best way for that too. In the engine, a larger crosshair image will make a larger crosshair, while this maybe SHOULD just decide its resolution.


As I said I have tried getting a draw method working but that failed. I don't know what went wrong but when I set it up, drawpic() wouldn't draw the image. I tried a '1 1 0' and '1 1 1' scale vector, used the position '0 0 0' (that should be the screen center if I'm right), a DRAWFLAG_NORMAL, 1 and 0, but nothing displayed in-game. I also couldn't get vectors working off cvar based floats (as for the RGB vector in drawpic() for instance, the vector must be something of the form 'getcvar(x_x_red) getcvar(x_x_green) getcvar(x_x_blue)' and similar for the scale vector) so I gave up after I looked closely but couldn't understand what was wrong with both problems. I guess I will try again although I think that someone more experienced should take a look. Maybe it's better that crosshairs are qcsc rendered... hope one of us coders can get it working.

[EDIT] I tried to remake that code and found how the vectors needed to be written like. I can compile the code without error but in-game, drawpic() does not display anything. This is my current if statement, please tell me what mistake I've done that causes this.

Code: Select all
   if(last_weapon != activeweapon) {   
      if(!cvar("crosshair_custom"))
         wcross = "default";
      else {
         e = get_weaponinfo(activeweapon);
         wcross = e.netname;
      }
      
      cvar_set("crosshair", "0"); //Temporarily disable client crosshair for testing.
      vector wcross_color, wcross_size;
      
      string wcross_style = strcat("gfx/crosshair", cvar_string(strcat("crosshair_", wcross)));
      wcross_color_x = cvar(strcat("crosshair_", wcross, "_color_red"));
      wcross_color_y = cvar(strcat("crosshair_", wcross, "_color_green"));
      wcross_color_z = cvar(strcat("crosshair_", wcross, "_color_blue"));
      wcross_size_x = cvar(strcat("crosshair_", wcross, "_size"));
      wcross_size_y = cvar(strcat("crosshair_", wcross, "_size"));
      wcross_size_z = 0;
      float wcross_alpha = cvar(strcat("crosshair_", wcross, "_color_alpha"));
      
      drawpic('0 0 0', wcross_style, wcross_size, wcross_color, wcross_alpha, DRAWFLAG_NORMAL);
      
      weapontime = time;
      last_weapon = activeweapon;
   }


Note: It's not the cvar getting (wcross-es) that are causing drawpic to not work, I have tried drawpic with manual values and that doesn't display anything either. It has to be either the vector position, vector size or the drawflags I think. I have also tried a vector size of '64 64 0' instead of '1 1 0' thinking that could be interpreted as pixels, but nothing.
MirceaKitsune
Keyboard killer
 
Posts: 593
Joined: Thu Aug 14, 2008 6:48 am
Location: Romania - Bucharest

Postby divVerent » Wed Jan 14, 2009 5:40 am

What WILL work is

wcross_size = wcross_size * 32;
drawpic('0.5 0 0' * (vid_conwidth - wcross_size_x) + '0 0.5 0' * (vid_conheight - wcross_size_y), wcross_style, wcross_size, wcross_color, wcross_alpha, DRAWFLAG_NORMAL);

The vectors are measured in console pixels.
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 » Wed Jan 14, 2009 11:00 am

I have managed to figure out almost everything and am now facing the final block in getting this to work. I spent two hours trying to figure out what was causing this issue yesterday but was not able to do so. Apparently, all floats, vectors, strings, etc. in CSQC_UpdateView() are unpersisted every frame. For example, if in void CSQC_UpdateView() you have "float test1234;" and later on "test1234 = 1;" without anything else changing that float again until UpdateView finishes, next frame test1234 is 0, even if the declaration of the float is actually done before CSQC_UpdateView(). This causes the crosshair to render only the next frame after you switch the weapon and then nothing appears. I tried hard but was unable to figure out how to work around this, so I need the final help here.

The reason why I positioned drawpic() far below if(last_weapon != activeweapon) is because it only renders there. That's the issue I described above which was causing my drawpic() not to work... as the code note says, "// NOTE: drawpic must happen after R_RenderScene for some reason". Also drawpic needs to execute every frame, so what we need is a way for all wcross_settings to remain unchanged if nothing happens and only be changed again on weapon switching.

Please take a look at my patch and tell me what methods I could use to fix this. If you apply that patch and go in game you will see the weapon crosshairs only persist for one frame after the weapon switch then vanish away. LINK 1 (sorry Filedropper, Mediafire was down), LINK 2
MirceaKitsune
Keyboard killer
 
Posts: 593
Joined: Thu Aug 14, 2008 6:48 am
Location: Romania - Bucharest

Postby divVerent » Wed Jan 14, 2009 11:27 am

Simply make it a global variable, and not a local one to the function. That is, move the declarations out.
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 » Wed Jan 14, 2009 2:35 pm

Odd... I remember trying that and it was still hiding it after a weapon switch. Probably because I only tested it with the style and not the alpha and size as well.

Anyway I have great news, the system is up and working exactly as it should now and is fully based on the drawpic() function. Now the engine's crosshair system can be removed as both the default and weapon based crosshairs work from csqc (the menu updates also fix the crosshair selectors to work on the new cvars for the non-custom crosshair). Also readjusted all current defaults at the correct sizes, and for the moment they look very good and comfortable to use. This patch can be downloaded from FILEDROPPER again or PASTEBIN.
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