Moves the player to his last waypoint
| 3836 | |
| 3837 | // Moves the player to his last waypoint |
| 3838 | void MovePlayerToWaypoint(object *objp) { |
| 3839 | ASSERT(objp->type == OBJ_PLAYER || objp->type == OBJ_GHOST); |
| 3840 | |
| 3841 | player *pp = &Players[objp->id]; |
| 3842 | |
| 3843 | // If this player has an auto-waypoint, use it. Else use global waypoint. |
| 3844 | if (pp->current_auto_waypoint_room != -1) { |
| 3845 | waypoint *wp; |
| 3846 | int i; |
| 3847 | |
| 3848 | // Find the waypoint |
| 3849 | for (i = 0, wp = Waypoints; i < Num_waypoints; i++, wp++) |
| 3850 | if (wp->roomnum == pp->current_auto_waypoint_room) |
| 3851 | break; |
| 3852 | ASSERT(i < Num_waypoints); |
| 3853 | |
| 3854 | ObjSetPos(objp, &wp->pos, wp->roomnum, &wp->orient, false); |
| 3855 | } else { |
| 3856 | ASSERT(Current_waypoint != -1); |
| 3857 | |
| 3858 | mprintf(0, "Resetting player ship to waypoint %d\n", Current_waypoint); |
| 3859 | ObjSetPos(objp, &Players[Current_waypoint].start_pos, Players[Current_waypoint].start_roomnum, |
| 3860 | &Players[Current_waypoint].start_orient, false); |
| 3861 | } |
| 3862 | } |
| 3863 | |
| 3864 | // Adds to the player's score & kill total |
| 3865 | void PlayerScoreAdd(int playernum, int points) { |
no test coverage detected