11/***************************************************************************************************
22 ApexReticle
33
4- Copyright 2024 roundRekt v1.1
4+ Copyright 2024 roundRekt v1.2
55 GitHub:https://github.com/roundRekt
66 bilibili:https://space.bilibili.com/2122119709
77
1212 https://github.com/roundRekt/ApexReticle
1313
1414 历史:
15+ 版本 1.2
16+ * 添加了腰射专用准星
17+ * 添加了三种准星样式
18+ * 添加了切换开镜兼容
1519 版本 1.1
1620 * 现在当高抛雷分划的显示策略设置为“捏雷时显示”时如果右键被按住则不会显示
1721 版本 1.0
2529
2630#include "ReShade.fxh"
2731
28- #define CROSSHAIR "自定义准星"
29- #define GRENADE "高抛雷分划"
30- #define AUTHOR "Copyright 2024 roundRekt v1.1"
31-
3232uniform bool Crosshair_Flag
3333<
34- ui_category = CROSSHAIR ;
34+ ui_category = "自定义准星" ;
3535 ui_label = "启用" ;
3636 ui_tooltip = "设置是否启用自定义准星" ;
3737> = 1 ;
3838
39+ uniform bool Crosshair_Toggle
40+ <
41+ ui_category = "自定义准星" ;
42+ ui_label = "切换开镜" ;
43+ ui_tooltip = "设置是否使用切换开镜" ;
44+ > = 0 ;
45+
46+ uniform int Crosshair_Display
47+ <
48+ ui_category = "自定义准星" ;
49+ ui_type = "combo" ;
50+ ui_items = "开镜时显示\0 开火时显示\0 开镜或开火时显示\0 始终显示\0 " ;
51+ ui_label = "显示策略" ;
52+ ui_tooltip = "设置自定义准星的显示策略(默认开火为鼠标左键,开镜为按住鼠标右键)" ;
53+ > = 0 ;
54+
55+ uniform int Crosshair_Type
56+ <
57+ ui_category = "自定义准星" ;
58+ ui_type = "combo" ;
59+ ui_items = "点状 ・\0 十字 +\0 叉形 ×\0 自定义准星图片\0 " ;
60+ ui_label = "准星样式" ;
61+ ui_tooltip = "设置准星的样式(“自定义准星图片”需要手动添加准星图片,并设置宽度和高度)" ;
62+ > = 0 ;
63+
3964uniform int Crosshair_Width
4065<
41- ui_category = CROSSHAIR ;
66+ ui_category = "自定义准星" ;
4267 ui_type = "slider" ;
4368 ui_min = 1 ;
4469 ui_max = 500 ;
4570 ui_step = 1 ;
46- ui_label = "宽度 " ;
47- ui_tooltip = "设置自定义准星的宽度(此项建议与图片宽度保持一致 )" ;
48- > = 8 ;
71+ ui_label = "图片宽度 " ;
72+ ui_tooltip = "设置自定义准星图片的宽度(当准星样式为“自定义准星图片”时生效,建议与图片宽度保持一致 )" ;
73+ > = 250 ;
4974
5075uniform int Crosshair_Height
5176<
52- ui_category = CROSSHAIR ;
77+ ui_category = "自定义准星" ;
5378 ui_type = "slider" ;
5479 ui_min = 1 ;
5580 ui_max = 500 ;
5681 ui_step = 1 ;
57- ui_label = "高度 " ;
58- ui_tooltip = "设置自定义准星的高度(此项建议与图片高度保持一致 )" ;
59- > = 8 ;
82+ ui_label = "图片高度 " ;
83+ ui_tooltip = "设置自定义准星图片的高度(当准星样式为“自定义准星图片”时生效,建议与图片高度保持一致 )" ;
84+ > = 250 ;
6085
61- uniform int Crosshair_Display
86+ uniform bool Crosshair_Hipfire
6287<
63- ui_category = CROSSHAIR;
88+ ui_category = "自定义准星" ;
89+ ui_label = "添加腰射准星" ;
90+ ui_tooltip = "设置是否添加腰射专用准星(仅在腰射时显示)" ;
91+ > = 1 ;
92+
93+ uniform int Crosshair_Hipfire_Type
94+ <
95+ ui_category = "自定义准星" ;
6496 ui_type = "combo" ;
65- ui_items = "开镜时显示 \0 开火时显示 \0 开镜或开火时显示 \0 始终显示 \0 " ;
66- ui_label = "显示策略 " ;
67- ui_tooltip = "设置自定义准星的显示策略(默认开火为鼠标左键,开镜为按住鼠标右键 )" ;
97+ ui_items = "点状 ・ \0 十字 + \0 叉形 × \0 自定义图片 \0 " ;
98+ ui_label = "准星样式 " ;
99+ ui_tooltip = "设置准星的样式(“自定义准星图片”需要手动添加准星图片,并设置宽度和高度 )" ;
68100> = 2 ;
69101
102+ uniform int Crosshair_Hipfire_Width
103+ <
104+ ui_category = "自定义准星" ;
105+ ui_type = "slider" ;
106+ ui_min = 1 ;
107+ ui_max = 500 ;
108+ ui_step = 1 ;
109+ ui_label = "图片宽度" ;
110+ ui_tooltip = "设置自定义准星图片的宽度(当准星样式为“自定义准星图片”时生效,建议与图片宽度保持一致)" ;
111+ > = 250 ;
112+
113+ uniform int Crosshair_Hipfire_Height
114+ <
115+ ui_category = "自定义准星" ;
116+ ui_type = "slider" ;
117+ ui_min = 1 ;
118+ ui_max = 500 ;
119+ ui_step = 1 ;
120+ ui_label = "图片高度" ;
121+ ui_tooltip = "设置自定义准星图片的高度(当准星样式为“自定义准星图片”时生效,建议与图片高度保持一致)" ;
122+ > = 250 ;
123+
70124uniform bool Grenade_Flag
71125<
72- ui_category = GRENADE ;
126+ ui_category = "高抛雷分划" ;
73127 ui_label = "启用" ;
74- ui_tooltip = "设置是否启用高抛雷分划(不提倡在对局中启用) " ;
128+ ui_tooltip = "设置是否启用高抛雷分划" ;
75129> = 1 ;
76130
77131uniform float Grenade_Opacity
78132<
79- ui_category = GRENADE ;
133+ ui_category = "高抛雷分划" ;
80134 ui_type = "slider" ;
81135 ui_min = 0 ;
82136 ui_max = 1 ;
@@ -87,7 +141,7 @@ uniform float Grenade_Opacity
87141
88142uniform int Grenade_FOV
89143<
90- ui_category = GRENADE ;
144+ ui_category = "高抛雷分划" ;
91145 ui_type = "combo" ;
92146 ui_items = "90\0 ""100\0 ""104\0 ""106\0 ""110\0 ""120\0 " ;
93147 ui_label = "视野(FOV)" ;
@@ -96,39 +150,39 @@ uniform int Grenade_FOV
96150
97151uniform int Grenade_Display
98152<
99- ui_category = GRENADE ;
153+ ui_category = "高抛雷分划" ;
100154 ui_type = "combo" ;
101155 ui_items = "捏雷时显示\0 始终显示\0 " ;
102156 ui_label = "显示策略" ;
103157 ui_tooltip = "设置高抛雷分划的显示策略(默认捏雷为长按鼠标左键)" ;
104158> = 0 ;
105159
106- uniform int Repository
160+ uniform int Bilibili
107161<
108- ui_category = AUTHOR ;
109- ui_type = "list " ;
110- ui_items = "https://github. com/roundRekt/ApexReticle \0 " ;
111- ui_label = "项目地址 " ;
112- ui_tooltip = "项目里有文字教程喵 ~" ;
113- > = 0 ;
162+ ui_category = "Copyright 2024 roundRekt v1.2" ;
163+ ui_type = "radio " ;
164+ ui_items = "https://space.bilibili. com/2122119709 \0 " ;
165+ ui_label = "bilibili " ;
166+ ui_tooltip = "空间里有视频教程喵 ~" ;
167+ >;
114168
115169uniform int GitHub
116170<
117- ui_category = AUTHOR ;
118- ui_type = "list " ;
171+ ui_category = "Copyright 2024 roundRekt v1.2" ;
172+ ui_type = "radio " ;
119173 ui_items = "https://github.com/roundRekt\0 " ;
120174 ui_label = "GitHub" ;
121175 ui_tooltip = "主页里有项目详情喵~" ;
122- > = 0 ;
176+ >;
123177
124- uniform int Bilibili
178+ uniform int Repository
125179<
126- ui_category = AUTHOR ;
127- ui_type = "list " ;
128- ui_items = "https://space.bilibili. com/2122119709 \0 " ;
129- ui_label = "bilibili " ;
130- ui_tooltip = "空间里有视频教程喵 ~" ;
131- > = 0 ;
180+ ui_category = "Copyright 2024 roundRekt v1.2" ;
181+ ui_type = "radio " ;
182+ ui_items = "https://github. com/roundRekt/ApexReticle \0 " ;
183+ ui_label = "项目地址 " ;
184+ ui_tooltip = "项目里有文字教程喵 ~" ;
185+ >;
132186
133187uniform bool Mouse_Left
134188<
@@ -144,13 +198,26 @@ uniform bool Mouse_Right
144198 toggle = false ;
145199>;
146200
147- texture Crosshair_Texture_KovaaK <source="KovaaK-Crosshair.png" ;> {Width = 500 ; Height = 500 ; Format = RGBA8;};
201+ uniform bool Mouse_Right_Toggle
202+ <
203+ source = "mousebutton" ;
204+ keycode = 1 ;
205+ toggle = true ;
206+ >;
207+
208+ texture Crosshair_Texture_Dot <source="Dot.png" ;> {Width = 8 ; Height = 8 ; Format = RGBA8;};
209+ texture Crosshair_Texture_Cross <source="Cross.png" ;> {Width = 100 ; Height = 100 ; Format = RGBA8;};
210+ texture Crosshair_Texture_X <source="X.png" ;> {Width = 62 ; Height = 62 ; Format = RGBA8;};
211+ texture Crosshair_Texture_KovaaK <source="KovaaK-Crosshair.png" ;> {Width = 500 ; Height = 500 ; Format = RGBA8;};
148212texture Grenade_Texture_FOV90 <source="FOV90.png" ;> {Width = 1920 ; Height = 1080 ; Format = RGBA8;};
149213texture Grenade_Texture_FOV100 <source="FOV100.png" ;> {Width = 1920 ; Height = 1080 ; Format = RGBA8;};
150214texture Grenade_Texture_FOV104 <source="FOV104.png" ;> {Width = 1920 ; Height = 1080 ; Format = RGBA8;};
151215texture Grenade_Texture_FOV106 <source="FOV106.png" ;> {Width = 1920 ; Height = 1080 ; Format = RGBA8;};
152216texture Grenade_Texture_FOV110 <source="FOV110.png" ;> {Width = 1920 ; Height = 1080 ; Format = RGBA8;};
153217texture Grenade_Texture_FOV120 <source="FOV120.png" ;> {Width = 1920 ; Height = 1080 ; Format = RGBA8;};
218+ sampler Crosshair_Sampler_Dot {Texture = Crosshair_Texture_Dot;};
219+ sampler Crosshair_Sampler_Cross {Texture = Crosshair_Texture_Cross;};
220+ sampler Crosshair_Sampler_X {Texture = Crosshair_Texture_X;};
154221sampler Crosshair_Sampler_KovaaK {Texture = Crosshair_Texture_KovaaK;};
155222sampler Grenade_Sampler_FOV90 {Texture = Grenade_Texture_FOV90;};
156223sampler Grenade_Sampler_FOV100 {Texture = Grenade_Texture_FOV100;};
@@ -162,18 +229,61 @@ sampler Grenade_Sampler_FOV120 {Texture = Grenade_Texture_FOV120;};
162229float4 VS_Crosshair (uint vid : SV_VertexID , out float2 texcoord : TexCoord ) : SV_POSITION
163230{
164231 texcoord.y = vid % 2 , texcoord.x = vid / 2 ;
165- return float4 ((texcoord.x*2 -1 .)*Crosshair_Width*BUFFER_RCP_WIDTH,(1 .-texcoord.y*2 )*Crosshair_Height*BUFFER_RCP_HEIGHT,0 ,1 );
232+ int Width,Height;
233+ switch (Crosshair_Type)
234+ {
235+ case 0 :Width=Height=8 *BUFFER_HEIGHT/1080 ; break ;
236+ case 1 :Width=Height=100 *BUFFER_HEIGHT/1080 ; break ;
237+ case 2 :Width=Height=62 *BUFFER_HEIGHT/1080 ; break ;
238+ case 3 :Width=Crosshair_Width; Height=Crosshair_Height; break ;
239+ }
240+ return float4 ((texcoord.x*2 -1 )*Width/BUFFER_WIDTH,(1 -texcoord.y*2 )*Height/BUFFER_HEIGHT,0 ,1 );
241+ }
242+
243+ float4 VS_Crosshair_Hipfire (uint vid : SV_VertexID , out float2 texcoord : TexCoord ) : SV_POSITION
244+ {
245+ texcoord.y = vid % 2 , texcoord.x = vid / 2 ;
246+ int Width,Height;
247+ switch (Crosshair_Hipfire_Type)
248+ {
249+ case 0 :Width=Height=8 *BUFFER_HEIGHT/1080 ; break ;
250+ case 1 :Width=Height=100 *BUFFER_HEIGHT/1080 ; break ;
251+ case 2 :Width=Height=62 *BUFFER_HEIGHT/1080 ; break ;
252+ case 3 :Width=Crosshair_Hipfire_Width; Height=Crosshair_Hipfire_Height; break ;
253+ }
254+ return float4 ((texcoord.x*2 -1 )*Width/BUFFER_WIDTH,(1 -texcoord.y*2 )*Height/BUFFER_HEIGHT,0 ,1 );
166255}
167256
168257float4 PS_Crosshair (float4 pos : SV_Position , float2 texcoord : TexCoord ) : SV_Target
169258{
170259 if (Crosshair_Flag)
171260 {
172- switch (Crosshair_Display)
261+ switch (Crosshair_Display)
262+ {
263+ case 0 :if (Crosshair_Toggle ? Mouse_Right_Toggle : Mouse_Right) {}else return 0 ; break ;
264+ case 1 :if (Mouse_Left) {}else return 0 ; break ;
265+ case 2 :if (Mouse_Left || (Crosshair_Toggle ? Mouse_Right_Toggle : Mouse_Right)) {}else return 0 ; break ;
266+ }
267+ switch (Crosshair_Type)
268+ {
269+ case 0 :return tex2D (Crosshair_Sampler_Dot, texcoord);
270+ case 1 :return tex2D (Crosshair_Sampler_Cross, texcoord);
271+ case 2 :return tex2D (Crosshair_Sampler_X, texcoord);
272+ case 3 :return tex2D (Crosshair_Sampler_KovaaK, texcoord);
273+ }
274+ }
275+ return 0 ;
276+ }
277+
278+ float4 PS_Crosshair_Hipfire (float4 pos : SV_Position , float2 texcoord : TexCoord ) : SV_Target
279+ {
280+ if (Crosshair_Hipfire && Mouse_Left && !(Crosshair_Toggle ? Mouse_Right_Toggle : Mouse_Right))
281+ {
282+ switch (Crosshair_Hipfire_Type)
173283 {
174- case 0 :if (Mouse_Right) { return tex2D (Crosshair_Sampler_KovaaK , texcoord);} break ;
175- case 1 :if (Mouse_Left) { return tex2D (Crosshair_Sampler_KovaaK , texcoord);} break ;
176- case 2 :if (Mouse_Left || Mouse_Right) { return tex2D (Crosshair_Sampler_KovaaK , texcoord);} break ;
284+ case 0 :return tex2D (Crosshair_Sampler_Dot , texcoord);
285+ case 1 :return tex2D (Crosshair_Sampler_Cross , texcoord);
286+ case 2 :return tex2D (Crosshair_Sampler_X , texcoord);
177287 case 3 :return tex2D (Crosshair_Sampler_KovaaK, texcoord);
178288 }
179289 }
@@ -182,7 +292,7 @@ float4 PS_Crosshair(float4 pos : SV_Position, float2 texcoord : TexCoord) : SV_T
182292
183293float4 PS_Grenade (float4 pos : SV_Position , float2 texcoord : TexCoord ) : SV_Target
184294{
185- if (Grenade_Flag && Mouse_Left && !Mouse_Right || Grenade_Display)
295+ if (Grenade_Flag && Mouse_Left && !(Crosshair_Toggle ? Mouse_Right_Toggle : Mouse_Right) || Grenade_Display)
186296 {
187297 switch (Grenade_FOV)
188298 {
@@ -212,6 +322,16 @@ technique ApexReticle
212322 SrcBlend = SRCALPHA;
213323 DestBlend = INVSRCALPHA;
214324 }
325+ pass CrosshairHipfirePass
326+ {
327+ VertexCount = 4 ;
328+ PrimitiveTopology = TRIANGLESTRIP;
329+ VertexShader = VS_Crosshair_Hipfire;
330+ PixelShader = PS_Crosshair_Hipfire;
331+ BlendEnable = true ;
332+ SrcBlend = SRCALPHA;
333+ DestBlend = INVSRCALPHA;
334+ }
215335 pass GrenadePass
216336 {
217337 VertexShader = PostProcessVS;
0 commit comments