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

Function LOSAndReturnTarget

TombEngine/Game/control/los.cpp:67–145  ·  view source on GitHub ↗

Deprecated.

Source from the content-addressed store, hash-verified

65
66// Deprecated.
67bool LOSAndReturnTarget(GameVector* origin, GameVector* target, int push)
68{
69 int x = origin->x;
70 int y = origin->y;
71 int z = origin->z;
72 short roomNumber = origin->RoomNumber;
73 short roomNumber2 = roomNumber;
74 int dx = (target->x - x) >> 3;
75 int dy = (target->y - y) >> 3;
76 int dz = (target->z - z) >> 3;
77 bool flag = false;
78 bool result = false;
79
80 int i;
81 for (i = 0; i < 8; ++i)
82 {
83 roomNumber2 = roomNumber;
84 auto* floor = GetFloor(x, y, z, &roomNumber);
85
86 if (g_Level.Rooms[roomNumber2].flags & ENV_FLAG_SWAMP)
87 {
88 flag = true;
89 break;
90 }
91
92 int floorHeight = GetFloorHeight(floor, x, y, z);
93 int ceilingHeight = GetCeiling(floor, x, y, z);
94 if (floorHeight != NO_HEIGHT && ceilingHeight != NO_HEIGHT && ceilingHeight < floorHeight)
95 {
96 if (y > floorHeight)
97 {
98 if (y - floorHeight >= push)
99 {
100 flag = true;
101 break;
102 }
103
104 y = floorHeight;
105 }
106
107 if (y < ceilingHeight)
108 {
109 if (ceilingHeight - y >= push)
110 {
111 flag = true;
112 break;
113 }
114
115 y = ceilingHeight;
116 }
117
118 result = true;
119 }
120 else if (result)
121 {
122 flag = true;
123 break;
124 }

Callers 5

UPVControlFunction · 0.85
LookCameraFunction · 0.85
MoveCameraFunction · 0.85
ChaseCameraFunction · 0.85
CombatCameraFunction · 0.85

Calls 3

GetFloorFunction · 0.85
GetFloorHeightFunction · 0.85
GetCeilingFunction · 0.85

Tested by

no test coverage detected