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

Method collide_update

src/SB/Core/x/xLaserBolt.cpp:210–256  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

208}
209
210void xLaserBoltEmitter::collide_update(bolt& b)
211{
212 xScene& scene = *globals.sceneCur;
213
214 // TODO: Investigate float regalloc mismatch
215 xRay3 ray;
216 ray.origin = b.origin;
217 ray.dir = b.dir;
218 ray.min_t = b.prev_check_dist - this->cfg.length;
219 ray.max_t = b.dist;
220 ray.flags = 0xC00;
221
222 if (ray.max_t < this->cfg.safe_dist)
223 {
224 ray.min_t = ray.max_t;
225 }
226
227 xCollis player_coll;
228 player_coll.flags = 0x300;
229 xRayHitsBound(&ray, &globals.player.ent.bound, &player_coll);
230
231 if (player_coll.flags & 0x1)
232 {
233 ray.max_t = player_coll.dist;
234 }
235
236 xCollis scene_coll;
237 scene_coll.flags = 0x300;
238 xRayHitsSceneFlags(&scene, &ray, &scene_coll, XENT_COLLTYPE_PLYR, 0xC);
239
240 if (scene_coll.flags & 0x1)
241 {
242 b.hit_dist = scene_coll.dist;
243 b.hit_norm = scene_coll.norm;
244 b.hit_ent = (xEnt*)scene_coll.optr;
245 }
246 else if (player_coll.flags & 0x1)
247 {
248 b.hit_dist = player_coll.dist;
249 b.hit_norm = player_coll.norm;
250 b.hit_ent = &globals.player.ent;
251 }
252
253 b.prev_check_dist = b.dist;
254
255 log_collide_dynamics(scene_coll.flags & 0x1 || player_coll.flags & 0x1);
256}
257
258RxObjSpace3DVertex* xLaserBoltEmitter::render(bolt& b, RxObjSpace3DVertex *vert)
259{

Callers

nothing calls this directly

Calls 2

xRayHitsBoundFunction · 0.70
xRayHitsSceneFlagsFunction · 0.70

Tested by

no test coverage detected