HLFX.Ru Forum
Показать все 5 сообщений этой темы на одной странице

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;
3
 
4
 
5
// Code by: PLut
6
int cross_size = velocity[3];
7
iHeight = 1;
8
iWidth = -4;
9
x = (ScreenWidth/2)-cross_size+1;
10
y = (ScreenHeight/2);
11
FillRGBA(x, y, iWidth, iHeight, r, g, b, 255);
12
 
13
// правая полоска
14
iHeight = 1;
15
iWidth = 4;
16
x = (ScreenWidth/2)+cross_size;
17
y = (ScreenHeight/2);
18
FillRGBA(x, y, iWidth, iHeight, r, g, b, 255);
19
 
20
// верхняя полоска
21
iHeight = -4;
22
iWidth = 1;
23
x = (ScreenWidth/2);
24
y = (ScreenHeight/2)-cross_size+1;
25
FillRGBA(x, y, iWidth, iHeight, r, g, b, 255);
26
 
27
// нижняя полоска
28
iHeight = 4;
29
iWidth = 1;
30
x = (ScreenWidth/2);
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.

__________________

xaerox on Vivino


Отправлено 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.


Временная зона GMT. Текущее время 08:49.
Показать все 5 сообщений этой темы на одной странице

На основе vBulletin версии 2.3.0
Авторское право © Jelsoft Enterprises Limited 2000 - 2002.
Дизайн и программирование: Crystice Softworks © 2005 - 2024