| 3239 | } |
| 3240 | |
| 3241 | void MultiDoRobotPos(uint8_t *data) { |
| 3242 | int count = 0; |
| 3243 | //@@multi_orientation multi_mat; |
| 3244 | // Skip header stuff |
| 3245 | SKIP_HEADER(data, &count); |
| 3246 | |
| 3247 | uint16_t server_objnum = MultiGetUshort(data, &count); |
| 3248 | uint16_t objectnum = Server_object_list[server_objnum]; |
| 3249 | if (objectnum == 65535 || !(Objects[objectnum].flags & OF_SERVER_OBJECT)) { |
| 3250 | mprintf(0, "Bad robotposition object number!\n"); |
| 3251 | return; |
| 3252 | } |
| 3253 | object *obj = &Objects[objectnum]; |
| 3254 | |
| 3255 | vector pos; |
| 3256 | matrix orient; |
| 3257 | uint16_t short_roomnum; |
| 3258 | int roomnum; |
| 3259 | |
| 3260 | // Get position |
| 3261 | MultiExtractPositionData(&pos, data, &count); |
| 3262 | |
| 3263 | // Get orientation |
| 3264 | uint16_t p = MultiGetShort(data, &count); |
| 3265 | uint16_t h = MultiGetShort(data, &count); |
| 3266 | uint16_t b = MultiGetShort(data, &count); |
| 3267 | |
| 3268 | vm_AnglesToMatrix(&orient, p, h, b); |
| 3269 | |
| 3270 | // Get room and terrain flag |
| 3271 | short_roomnum = MultiGetUshort(data, &count); |
| 3272 | uint8_t terrain = MultiGetByte(data, &count); |
| 3273 | |
| 3274 | roomnum = short_roomnum; |
| 3275 | if (terrain) |
| 3276 | roomnum = MAKE_ROOMNUM(roomnum); |
| 3277 | vector vel = {0, 0, 0}; |
| 3278 | |
| 3279 | // Get velocity |
| 3280 | vel.x = ((float)MultiGetShort(data, &count)) / 128.0; |
| 3281 | vel.y = ((float)MultiGetShort(data, &count)) / 128.0; |
| 3282 | vel.z = ((float)MultiGetShort(data, &count)) / 128.0; |
| 3283 | obj->mtype.phys_info.velocity = vel; |
| 3284 | |
| 3285 | obj->mtype.phys_info.flags &= ~PF_NO_COLLIDE; |
| 3286 | obj->render_type = RT_POLYOBJ; |
| 3287 | |
| 3288 | if (!(obj->flags & (OF_DEAD)) && obj->type != OBJ_NONE) { |
| 3289 | ObjSetPos(obj, &pos, roomnum, &orient, false); |
| 3290 | } |
| 3291 | } |
| 3292 | |
| 3293 | // Stuffs a players firing information into a packet |
| 3294 | int MultiStuffPlayerFire(int slot, uint8_t *data) { |
no test coverage detected