MCPcopy Create free account
hub / github.com/bfbbdecomp/bfbb / xShadowSimple_Init

Function xShadowSimple_Init

src/SB/Core/x/xShadowSimple.cpp:85–122  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

83 if (ent->baseType == 0x2b)
84 {
85 xNPCBasic* npc = (xNPCBasic*)ent;
86 if ((npc->SelfType() & 0xFFFFFF00) == 0x4E545400)
87 {
88 xVec3 start;
89 xVec3Init(&start, ((shadowRayEntData*)data)->line->start.x,
90 ((shadowRayEntData*)data)->line->start.y,
91 ((shadowRayEntData*)data)->line->start.z);
92
93 F32 end_y = ((shadowRayEntData*)data)->line->end.y;
94 F32 start_y = start.y;
95 F32 dy = end_y - start_y;
96 F32 t = (ent->bound.box.box.upper.y - start_y) / dy;
97
98 if (((shadowRayEntData*)data)->cache->shadowHeight > t &&
99 ent->bound.box.box.upper.y > end_y)
100 {
101 if (start.x > ent->bound.box.box.lower.x &&
102 start.x < ent->bound.box.box.upper.x &&
103 start.z > ent->bound.box.box.lower.z &&
104 start.z < ent->bound.box.box.upper.z)
105 {
106 ((shadowRayEntData*)data)->cache->shadowHeight = t;
107 xVec3 temp_vec;
108
109 temp_vec.y = ent->bound.box.box.upper.y;
110 temp_vec.z = start.z;
111 temp_vec.x = start.x + 10.0f;
112
113 xVec3SubFrom(&temp_vec, (const xVec3*)&ent->model->Mat->pos);
114
115 ((shadowRayEntData*)data)->cache->poly.vert[0].x =
116 xVec3Dot(&temp_vec, (const xVec3*)&ent->model->Mat->right);
117 ((shadowRayEntData*)data)->cache->poly.vert[0].y =
118 xVec3Dot(&temp_vec, (const xVec3*)&ent->model->Mat->up);
119 ((shadowRayEntData*)data)->cache->poly.vert[0].z =
120 xVec3Dot(&temp_vec, (const xVec3*)&ent->model->Mat->at);
121
122 temp_vec.y = ent->bound.box.box.upper.y;
123 temp_vec.x = start.x - 10.0f;
124 temp_vec.z = start.z + 10.0f;
125

Callers 1

zMainLoopFunction · 0.50

Calls 3

memsetFunction · 0.85
xSTFindAssetFunction · 0.70
xStrHashFunction · 0.70

Tested by

no test coverage detected