]> git.rm.cloudns.org Git - voretournament/voretournament.git/commitdiff
Port aiming reticles from Xonotic.
authorMirceaKitsune <sonichedgehog_hyperblast00@yahoo.com>
Mon, 28 Feb 2011 22:40:42 +0000 (00:40 +0200)
committerMirceaKitsune <sonichedgehog_hyperblast00@yahoo.com>
Mon, 28 Feb 2011 22:40:42 +0000 (00:40 +0200)
data/defaultVoretournament.cfg
data/qcsrc/client/View.qc

index 6fa6750aed2aba58e93b8255f32916fd17b535b9..c40476e3b524ad10bb7fb2ed9aa92cec07a2dea2 100644 (file)
@@ -128,6 +128,10 @@ seta cl_artwork_lose 2 "number of artwork_lost_ images available in the gfx fold
 seta cl_artwork_stretch 0 "stretch artwork to fit the screen, even if it brakes image proportions"\r
 seta cl_artwork_alpha 1 "artwork alpha"\r
 seta cl_artwork_fade 0.3 "artwork fade in speed"\r
+\r
+seta cl_reticle_stretch 0 "whether to stretch reticles so they fit the screen (brakes image proportions)"\r
+seta cl_reticle_item_weapon 1 "draw aiming reticle for weapon zoom, 0 disables and values between 0 and 1 change alpha"\r
+seta cl_reticle_item_normal 1 "draw reticle when zooming without a weapon, 0 disables and values between 0 and 1 change alpha"\r
 fov 90\r
 seta cl_velocityzoom 0 "velocity based zooming of fov, negative values zoom out"\r
 seta cl_velocityzoomtime 0.3   "time value for averaging speed values"\r
index ecdadde987682bfe000f00861a3e695761b78d78..9a1b97ab6d89b078e5ccbb9006f1801010c34759 100644 (file)
@@ -250,6 +250,7 @@ void CSQC_Demo_Camera();
 float Sbar_WouldDrawScoreboard ();\r
 float view_set;\r
 float camera_mode;\r
+float reticle_type;\r
 float chase_active_old;\r
 float artwork_fade;\r
 float pickup_crosshair_time, pickup_crosshair_size;\r
@@ -272,6 +273,7 @@ void CSQC_UpdateView(float w, float h)
        vector v, vo;\r
        float a;\r
 \r
+       vector reticle_pos, reticle_size;\r
        vector artwork_pos, artwork_size;\r
 \r
        WaypointSprite_Load();\r
@@ -460,6 +462,48 @@ void CSQC_UpdateView(float w, float h)
        // next R_RenderScene call\r
        drawstring('0 0 0', "", '1 1 0', '1 1 1', 0, 0);\r
 \r
+       // Draw the aiming reticle for weapons that use it\r
+       // reticle_type is changed to the item we are zooming / aiming with, to decide which reticle to use\r
+       // It must be a persisted float for fading out to work properly (you let go of the zoom button for\r
+       // the view to go back to normal, so reticle_type would become 0 as we fade out)\r
+       if(spectatee_status || getstati(STAT_HEALTH) <= 0)\r
+               reticle_type = 0; // prevent reticle from showing during the respawn zoom effect or for spectators\r
+       else if(activeweapon && (button_zoom || zoomscript_caught))\r
+               reticle_type = 2; // weapon zoom\r
+       else if(button_zoom || zoomscript_caught)\r
+               reticle_type = 1; // normal zoom\r
+\r
+       if(cvar("cl_reticle_stretch"))\r
+       {\r
+               reticle_size_x = vid_conwidth;\r
+               reticle_size_y = vid_conheight;\r
+               reticle_pos_x = 0;\r
+               reticle_pos_y = 0;\r
+       }\r
+       else\r
+       {\r
+               reticle_size_x = max(vid_conwidth, vid_conheight);\r
+               reticle_size_y = max(vid_conwidth, vid_conheight);\r
+               reticle_pos_x = (vid_conwidth - reticle_size_x) / 2;\r
+               reticle_pos_y = (vid_conheight - reticle_size_y) / 2;\r
+       }\r
+\r
+       f = current_zoomfraction;\r
+       if(zoomscript_caught)\r
+               f = 1;\r
+       if(cvar("cl_reticle_item_normal"))\r
+       {\r
+               precache_pic("gfx/reticle_normal");\r
+               if(reticle_type == 1 && f)\r
+                       drawpic(reticle_pos, "gfx/reticle_normal", reticle_size, '1 1 1', f * cvar("cl_reticle_item_normal"), DRAWFLAG_NORMAL);\r
+       }\r
+       if(cvar("cl_reticle_item_weapon"))\r
+       {\r
+               precache_pic("gfx/reticle_weapon");\r
+               if(reticle_type == 2 && f)\r
+                       drawpic(reticle_pos, "gfx/reticle_weapon", reticle_size, '1 1 1', f * cvar("cl_reticle_item_weapon"), DRAWFLAG_NORMAL);\r
+       }\r
+\r
        // screen effects\r
        if(cvar("hud_contents"))\r
        {\r