Server is telling us about a player who is changing his observer mode
| 6129 | |
| 6130 | // Server is telling us about a player who is changing his observer mode |
| 6131 | void MultiDoObserverChange(uint8_t *data) { |
| 6132 | int count = 0; |
| 6133 | int objnum = -1; |
| 6134 | |
| 6135 | SKIP_HEADER(data, &count); |
| 6136 | |
| 6137 | int slot = MultiGetByte(data, &count); |
| 6138 | uint8_t mode = MultiGetByte(data, &count); |
| 6139 | uint8_t on = MultiGetByte(data, &count); |
| 6140 | int restart_slot = MultiGetShort(data, &count); |
| 6141 | if (mode == OBSERVER_MODE_PIGGYBACK) { |
| 6142 | if (Netgame.local_role == LR_SERVER) |
| 6143 | objnum = MultiGetInt(data, &count); |
| 6144 | else { |
| 6145 | objnum = Server_object_list[MultiGetInt(data, &count)]; |
| 6146 | MULTI_ASSERT_NOMESSAGE(objnum != 65535); |
| 6147 | } |
| 6148 | } |
| 6149 | |
| 6150 | if (on) |
| 6151 | PlayerSwitchToObserver(slot, mode, objnum); |
| 6152 | else { |
| 6153 | Player_pos_fix[slot].active = true; |
| 6154 | Player_pos_fix[slot].expire_time = Gametime + PLAYER_POS_HACK_TIME; |
| 6155 | Player_pos_fix[slot].room = Players[restart_slot].start_roomnum; |
| 6156 | Player_pos_fix[slot].ignored_pos = 0; |
| 6157 | PlayerStopObserving(slot); |
| 6158 | PlayerMoveToStartPos(slot, restart_slot); |
| 6159 | } |
| 6160 | } |
| 6161 | |
| 6162 | // Someone is asking us for permission to enter observer mode |
| 6163 | void MultiDoRequestToObserve(uint8_t *data) { |
no test coverage detected