Spews an object in a random direction
| 2795 | |
| 2796 | // Spews an object in a random direction |
| 2797 | void PlayerSpewObject(object *objp, int timed, int room, vector *pos, matrix *orient) { |
| 2798 | ASSERT((!(Game_mode & GM_MULTI)) || (Netgame.local_role == LR_SERVER)); |
| 2799 | |
| 2800 | ObjSetPos(objp, pos, room, orient, true); |
| 2801 | |
| 2802 | // Set random velocity for powerups |
| 2803 | objp->mtype.phys_info.velocity.x = ((ps_rand() / (float)D3_RAND_MAX) - .5f) * 40.0; // +20 to -20 |
| 2804 | objp->mtype.phys_info.velocity.z = ((ps_rand() / (float)D3_RAND_MAX) - .5f) * 40.0; // +20 to -20 |
| 2805 | objp->mtype.phys_info.velocity.y = ((ps_rand() / (float)D3_RAND_MAX) - .5f) * 40.0; // +20 to -20 |
| 2806 | |
| 2807 | // Send object to other players |
| 2808 | if (Game_mode & GM_MULTI) { |
| 2809 | if (Netgame.flags & NF_COOP) |
| 2810 | timed = 0; |
| 2811 | |
| 2812 | if (Netgame.local_role == LR_SERVER) { |
| 2813 | if (timed == 2) { |
| 2814 | objp->flags |= OF_USES_LIFELEFT; |
| 2815 | objp->lifeleft = 20.0; |
| 2816 | } else if (timed == 1) { |
| 2817 | objp->flags |= OF_USES_LIFELEFT; |
| 2818 | objp->lifeleft = 180.0; |
| 2819 | } |
| 2820 | DemoWriteObjLifeLeft(objp); |
| 2821 | } |
| 2822 | } |
| 2823 | } |
| 2824 | |
| 2825 | // Spews an object in a random direction |
| 2826 | // Returns the new object |
no test coverage detected