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

Function PrepareRope

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

Source from the content-addressed store, hash-verified

44 }
45
46 void PrepareRope(ROPE_STRUCT* rope, Vector3i* pos1, Vector3i* pos2, int length, ItemInfo* item)
47 {
48 rope->index = item->Index;
49 rope->room = item->RoomNumber;
50 rope->position = *pos1;
51 rope->segmentLength = length << 16;
52
53 pos2->x <<= 16;
54 pos2->y <<= 16;
55 pos2->z <<= 16;
56
57 NormaliseRopeVector(pos2);
58
59 if (item->TriggerFlags == -1)
60 rope->coiled = 30;
61 else
62 rope->coiled = 0;
63
64 for (int i = 0; i < ROPE_SEGMENTS; ++i)
65 {
66 rope->segment[i].x = (long long)(rope->segmentLength * i) * pos2->x >> FP_SHIFT;
67 rope->segment[i].y = (long long)(rope->segmentLength * i) * pos2->y >> FP_SHIFT;
68 rope->segment[i].z = (long long)(rope->segmentLength * i) * pos2->z >> FP_SHIFT;
69
70 rope->velocity[i].x = 0;
71 rope->velocity[i].y = 0;
72 rope->velocity[i].z = 0;
73
74 if (item->TriggerFlags == -1)
75 {
76 rope->segment[i].x = 1024 * i;
77 rope->segment[i].y >>= 4;
78
79 rope->velocity[i].x = 16384;
80 rope->velocity[i].y = 131072 * (ROPE_SEGMENTS - i);
81 rope->velocity[i].z = 16384;
82 }
83 }
84
85 rope->active = 0;
86 }
87
88 Vector3i* NormaliseRopeVector(Vector3i* vec)
89 {

Callers 1

InitializeRopeFunction · 0.85

Calls 1

NormaliseRopeVectorFunction · 0.85

Tested by

no test coverage detected