Process a collision between an object and a wall Returns true if the object hits the wall, and false if should keep going though the wall (for breakable glass)
| 2650 | // Process a collision between an object and a wall |
| 2651 | // Returns true if the object hits the wall, and false if should keep going though the wall (for breakable glass) |
| 2652 | bool collide_object_with_wall(object *A, float hitspeed, int hitseg, int hitwall, vector *hitpt, vector *wall_normal, |
| 2653 | float hit_dot) { |
| 2654 | uint8_t do_event = 0; |
| 2655 | bool ret = true; |
| 2656 | |
| 2657 | switch (A->type) { |
| 2658 | case OBJ_NONE: |
| 2659 | Error("A object of type NONE hit a wall!\n"); |
| 2660 | break; |
| 2661 | case OBJ_PLAYER: |
| 2662 | collide_player_and_wall(A, hitspeed, hitseg, hitwall, hitpt, wall_normal, hit_dot); |
| 2663 | do_event = 1; |
| 2664 | break; |
| 2665 | case OBJ_WEAPON: |
| 2666 | ret = collide_weapon_and_wall(A, hitspeed, hitseg, hitwall, hitpt, wall_normal, hit_dot); |
| 2667 | do_event = 1; |
| 2668 | break; |
| 2669 | case OBJ_DEBRIS: |
| 2670 | break; // chrishack -- collide_debris_and_wall(A,hitspeed,hitseg,hitwall,hitpt); break; |
| 2671 | case OBJ_FIREBALL: |
| 2672 | break; // collide_fireball_and_wall(A,hitspeed,hitseg,hitwall,hitpt); |
| 2673 | case OBJ_CLUTTER: |
| 2674 | case OBJ_BUILDING: |
| 2675 | case OBJ_ROBOT: |
| 2676 | collide_generic_and_wall(A, hitspeed, hitseg, hitwall, hitpt, wall_normal, hit_dot); |
| 2677 | do_event = 1; |
| 2678 | break; |
| 2679 | case OBJ_VIEWER: |
| 2680 | break; // collide_camera_and_wall(A,hitspeed,hitseg,hitwall,hitpt); |
| 2681 | case OBJ_POWERUP: |
| 2682 | break; // collide_powerup_and_wall(A,hitspeed,hitseg,hitwall,hitpt); |
| 2683 | case OBJ_GHOST: |
| 2684 | break; // do nothing |
| 2685 | case OBJ_OBSERVER: |
| 2686 | break; // do nothing |
| 2687 | case OBJ_SPLINTER: |
| 2688 | break; |
| 2689 | case OBJ_MARKER: |
| 2690 | break; |
| 2691 | case OBJ_SHARD: |
| 2692 | if (sound_override_glass_breaking == -1) |
| 2693 | Sound_system.Play3dSound(SOUND_BREAKING_GLASS, SND_PRIORITY_NORMAL, A, MAX_GAME_VOLUME / 10); |
| 2694 | else |
| 2695 | Sound_system.Play3dSound(sound_override_glass_breaking, SND_PRIORITY_NORMAL, A, MAX_GAME_VOLUME / 10); |
| 2696 | break; |
| 2697 | |
| 2698 | default: |
| 2699 | mprintf(0, "Unhandled collision of object type %d and wall\n", A->type); |
| 2700 | // Error( "Unhandled object type hit wall in collide.c\n" ); |
| 2701 | } |
| 2702 | |
| 2703 | if (do_event && (Game_mode & GM_MULTI)) { |
| 2704 | // call multiplayer event |
| 2705 | DLLInfo.me_handle = A->handle; |
| 2706 | DLLInfo.it_handle = OBJECT_HANDLE_NONE; |
| 2707 | DLLInfo.collide_info.point.x = hitpt->x; |
| 2708 | DLLInfo.collide_info.point.y = hitpt->y; |
| 2709 | DLLInfo.collide_info.point.z = hitpt->z; |
no test coverage detected