HLFX.Ru Forum (https://hlfx.ru/forum/index.php)
- Half-Life SDK (https://hlfx.ru/forum/forumdisplay.php?forumid=8)
-- Crosshair size depends of the speed (https://hlfx.ru/forum/showthread.php?threadid=3774)
Отправлено MisterDeath 26-01-2013 в 23:53:
Crosshair size depends of the speed
What is bad ? ( sorry bad english )
C++ Source Code:
1 | cl_entity_t *player = gEngfuncs.GetLocalPlayer(); |
2 | vec3_t velocity = player->curstate.velocity; |
6 | int cross_size = velocity[3]; |
9 | x = (ScreenWidth/2)-cross_size+1; |
11 | FillRGBA(x, y, iWidth, iHeight, r, g, b, 255); |
16 | x = (ScreenWidth/2)+cross_size; |
18 | FillRGBA(x, y, iWidth, iHeight, r, g, b, 255); |
24 | y = (ScreenHeight/2)-cross_size+1; |
25 | FillRGBA(x, y, iWidth, iHeight, r, g, b, 255); |
31 | y = (ScreenHeight/2)+cross_size; |
32 | FillRGBA(x, y, iWidth, iHeight, r, g, b, 255); |
The crosshair size not change the size ( the size depend of the client velocity )__________________
hl 4 ever
Отправлено pRoxxx 27-01-2013 в 00:07:
int cross_size = velocity[3];
its Z , up dir. Size changed only when u jump etc.
Try something like this:
C++ Source Code:
float cross_size =sqrt(velocity[0] * velocity[0] + velocity[1] * velocity[1])/maxspeed // Ranged from 0 to 1; |
Отправлено XaeroX 27-01-2013 в 03:41:
That's even not Z, velocity is a 3-component vector, and index 3 is out of range 0..2.
__________________
Отправлено Ku2zoff 27-01-2013 в 06:00:
Цитата:
pRoxxx писал:
Try something like this:
There is a function that does the same, and it already present in hlsdk.
Try something like this:
C++ Source Code:
float cross_size = velocity.Length(); |
All 3 axes.
C++ Source Code:
float cross_size = velocity.Length2D(); |
X and Y, only horizontal speed.
Отправлено pRoxxx 27-01-2013 в 14:00:
Цитата:
XaeroX писал:
That's even not Z, velocity is a 3-component vector, and index 3 is out of range 0..2.
Yup u right.Цитата:
Ku2zoff писал:
There is a function that does the same, and it already present in hlsdk.
And u too right.