MCPcopy Create free account
hub / github.com/TombEngine/TombEngine / NormaliseRopeVector

Function NormaliseRopeVector

TombEngine/Objects/Generic/Object/rope.cpp:88–107  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

86 }
87
88 Vector3i* NormaliseRopeVector(Vector3i* vec)
89 {
90 int x = vec->x >> FP_SHIFT;
91 int y = vec->y >> FP_SHIFT;
92 int z = vec->z >> FP_SHIFT;
93
94 if (!x && !y && !z)
95 return vec;
96
97 int length = SQUARE(x) + SQUARE(y) + SQUARE(z);
98 if (length < 0)
99 length = -length;
100
101 length = 65536 / sqrt(length);
102
103 vec->x = ((int64_t)length * vec->x) >> FP_SHIFT;
104 vec->y = ((int64_t)length * vec->y) >> FP_SHIFT;
105 vec->z = ((int64_t)length * vec->z) >> FP_SHIFT;
106 return vec;
107 }
108
109 void GetRopePos(ROPE_STRUCT* rope, int segmentFrame, int* x, int* y, int* z)
110 {

Callers 5

PrepareRopeFunction · 0.85
RopeDynamicsFunction · 0.85
ModelRigidRopeFunction · 0.85
ModelRigidFunction · 0.85
DelAlignLaraToRopeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected