@@ -207,6 +207,54 @@ void xLaserBoltEmitter::pre_collide(bolt& b)
207207 log_collide_statics (coll.flags & 0x1 );
208208}
209209
210+ void 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+
210258RxObjSpace3DVertex* xLaserBoltEmitter::render (bolt& b, RxObjSpace3DVertex *vert)
211259{
212260 F32 dist0 = b.prev_dist - this ->cfg .length ;
0 commit comments