Sets the Current Mode
| 2583 | |
| 2584 | // Sets the Current Mode |
| 2585 | void AlienOrganism::SetMode(int me, char mode) { |
| 2586 | // mprintf(0, "From mode %d, ",memory->mode); |
| 2587 | |
| 2588 | int flags; |
| 2589 | char movement_type; |
| 2590 | vector vel; |
| 2591 | |
| 2592 | // Clear out any goals |
| 2593 | AI_SafeSetType(me, AIT_AIS); |
| 2594 | |
| 2595 | // Set FOV to 360 |
| 2596 | float fov = -1.0f; |
| 2597 | AI_Value(me, VF_SET, AIV_F_FOV, &fov); |
| 2598 | |
| 2599 | // Turn off ranged firing |
| 2600 | flags = AIF_DISABLE_FIRING; |
| 2601 | AI_Value(me, VF_SET_FLAGS, AIV_I_FLAGS, &flags); |
| 2602 | |
| 2603 | // Make it persistant |
| 2604 | flags = AIF_PERSISTANT; |
| 2605 | AI_Value(me, VF_SET_FLAGS, AIV_I_FLAGS, &flags); |
| 2606 | |
| 2607 | // Turn off the energy beams |
| 2608 | memory->energy_beams_on = false; |
| 2609 | |
| 2610 | // Do mode specific setups |
| 2611 | switch (mode) { |
| 2612 | case ALIEN_GOING_HOME: { |
| 2613 | // mprintf(0,"Going home mode set.\n"); |
| 2614 | |
| 2615 | ray_info ray; |
| 2616 | int fate; |
| 2617 | vector end_pos, landing_pos; |
| 2618 | int end_room, landing_room; |
| 2619 | |
| 2620 | // If currently landed, set take off velocity |
| 2621 | DoTakeoff(me, 8.0f, 3.0f); |
| 2622 | |
| 2623 | // Turn on friend avoidance |
| 2624 | flags = AIF_AUTO_AVOID_FRIENDS; |
| 2625 | AI_Value(me, VF_SET_FLAGS, AIV_I_FLAGS, &flags); |
| 2626 | |
| 2627 | // Set friend avoidance distance |
| 2628 | float avoid_dist = ALIEN_NORMAL_AVOID_DIST; |
| 2629 | AI_Value(me, VF_SET, AIV_F_AVOID_FRIENDS_DIST, &avoid_dist); |
| 2630 | SetCircleDist(me, memory->base_circle_distance); |
| 2631 | |
| 2632 | // Make it aware |
| 2633 | flags = AIF_FORCE_AWARENESS; |
| 2634 | AI_Value(me, VF_SET_FLAGS, AIV_I_FLAGS, &flags); |
| 2635 | |
| 2636 | // Clear wall point collision and axes lock |
| 2637 | flags = PF_POINT_COLLIDE_WALLS; |
| 2638 | Obj_Value(me, VF_CLEAR_FLAGS, OBJV_I_PHYSICS_FLAGS, &flags); |
| 2639 | |
| 2640 | // Set movement type back to physics for flying around |
| 2641 | movement_type = MT_PHYSICS; |
| 2642 | Obj_Value(me, VF_SET, OBJV_C_MOVEMENT_TYPE, &movement_type); |
nothing calls this directly
no test coverage detected