Parent Directory | Revision Log
Revision 1 - (view) (download)
1 : | ian | 1 | /* Vector functions (now part of Core) |
2 : | * | ||
3 : | * by the AMX Mod X Development Team | ||
4 : | * | ||
5 : | * This file is provided as is (no warranties). | ||
6 : | */ | ||
7 : | |||
8 : | #if defined _corevector_included | ||
9 : | #endinput | ||
10 : | #endif | ||
11 : | #define _corevector_included | ||
12 : | |||
13 : | /* Used for angle_vector() */ | ||
14 : | #define ANGLEVECTOR_FORWARD 1 | ||
15 : | #define ANGLEVECTOR_RIGHT 2 | ||
16 : | #define ANGLEVECTOR_UP 3 | ||
17 : | |||
18 : | /* Returns distance between two vectors. */ | ||
19 : | native get_distance(const origin1[3], const origin2[3]); | ||
20 : | |||
21 : | /* Gets distance between two origins (float). */ | ||
22 : | native Float:get_distance_f(const Float:Origin1[3], const Float:Origin2[3]); | ||
23 : | |||
24 : | /* Gives you a velocity in the direction a player is looking, iVelocity is the multiplier. */ | ||
25 : | native velocity_by_aim(iIndex, iVelocity, Float:vRetValue[3]); | ||
26 : | |||
27 : | /* Changes a vector into an angle vector. */ | ||
28 : | native vector_to_angle(const Float:fVector[3], Float:vReturn[3]); | ||
29 : | |||
30 : | /* Changes an angle vector into a vector. */ | ||
31 : | native angle_vector(const Float:vector[3], FRU, Float:ret[3]); | ||
32 : | |||
33 : | /* Gets the length of a vector (float[3]). */ | ||
34 : | native Float:vector_length(const Float:vVector[3]); | ||
35 : | |||
36 : | /* Gets the distance between 2 vectors (float[3]). */ | ||
37 : | native Float:vector_distance(const Float:vVector[3], const Float:vVector2[3]); | ||
38 : | |||
39 : | /* Changes an integer vec to a floating vec | ||
40 : | * This is not a for loop because that's slower | ||
41 : | */ | ||
42 : | stock IVecFVec(const IVec[3], Float:FVec[3]) | ||
43 : | { | ||
44 : | FVec[0] = float(IVec[0]); | ||
45 : | FVec[1] = float(IVec[1]); | ||
46 : | FVec[2] = float(IVec[2]); | ||
47 : | |||
48 : | return 1; | ||
49 : | } | ||
50 : | |||
51 : | /* Changes a float vec to an integer vec */ | ||
52 : | stock FVecIVec(const Float:FVec[3], IVec[3]) | ||
53 : | { | ||
54 : | IVec[0] = floatround(FVec[0]); | ||
55 : | IVec[1] = floatround(FVec[1]); | ||
56 : | IVec[2] = floatround(FVec[2]); | ||
57 : | |||
58 : | return 1; | ||
59 : | } |
Contact | ViewVC Help |
Powered by ViewVC 1.0.4 |