| 2388 | #define ALIEN_ATTEMPT_BEAM_DIST 40.0f |
| 2389 | |
| 2390 | void AlienOrganism::ProjectBeam(int me, int pos_handle, vector *start_pos, int start_room, vector *beam_dir, |
| 2391 | matrix *orient, int beam_flag) { |
| 2392 | ray_info ray; |
| 2393 | int flags, fate; |
| 2394 | vector end_pos, landing_pos; |
| 2395 | int landing_room; |
| 2396 | float dist; |
| 2397 | |
| 2398 | // Calculate beam's destination |
| 2399 | end_pos = (*start_pos) + ((*beam_dir) * ALIEN_ATTEMPT_BEAM_DIST); |
| 2400 | |
| 2401 | flags = FQ_CHECK_OBJS | FQ_IGNORE_POWERUPS | FQ_IGNORE_WEAPONS | FQ_IGNORE_MOVING_OBJECTS | |
| 2402 | FQ_IGNORE_NON_LIGHTMAP_OBJECTS; |
| 2403 | fate = FVI_RayCast(me, start_pos, &end_pos, start_room, 0.0f, flags, &ray); |
| 2404 | |
| 2405 | landing_pos = ray.hit_point; |
| 2406 | landing_room = ray.hit_room; |
| 2407 | |
| 2408 | // If beam is within certain distance, move the destination object to destination position |
| 2409 | dist = vm_VectorDistance(start_pos, &landing_pos); |
| 2410 | if (dist < ALIEN_MAX_BEAM_DIST) { |
| 2411 | msafe_struct mstruct; |
| 2412 | mstruct.objhandle = pos_handle; |
| 2413 | mstruct.pos = landing_pos; |
| 2414 | mstruct.orient = (*orient); |
| 2415 | mstruct.roomnum = landing_room; |
| 2416 | MSafe_CallFunction(MSAFE_OBJECT_WORLD_POSITION, &mstruct); |
| 2417 | |
| 2418 | // Mark this beam as enabled |
| 2419 | memory->enabled_beams |= beam_flag; |
| 2420 | } |
| 2421 | } |
| 2422 | |
| 2423 | // Calculates positions and moves invisible powerups to them |
| 2424 | void AlienOrganism::CalcEnergyBeamPositions(int me) { |
nothing calls this directly
no test coverage detected