Server is telling us about objects in the game
| 4582 | |
| 4583 | // Server is telling us about objects in the game |
| 4584 | void MultiDoJoinObjects(uint8_t *data) { |
| 4585 | int count = 0; |
| 4586 | |
| 4587 | SKIP_HEADER(data, &count); |
| 4588 | uint8_t num_objects = MultiGetByte(data, &count); |
| 4589 | |
| 4590 | mprintf(0, "Got join object packet. Num objects=%d\n", num_objects); |
| 4591 | |
| 4592 | for (int i = 0; i < num_objects; i++) { |
| 4593 | bool obj_is_dummy = false; |
| 4594 | |
| 4595 | // Extract info about this object |
| 4596 | uint16_t server_objnum = MultiGetUshort(data, &count); |
| 4597 | uint8_t type = MultiGetByte(data, &count); |
| 4598 | |
| 4599 | //@@mprintf(0,"Got join objnum %d from server. Type=%d\n",server_objnum,type); |
| 4600 | |
| 4601 | if (type == OBJ_DUMMY) { |
| 4602 | obj_is_dummy = true; |
| 4603 | type = MultiGetByte(data, &count); |
| 4604 | } |
| 4605 | |
| 4606 | uint32_t checksum; |
| 4607 | matrix orient; |
| 4608 | uint8_t name_len = 0; |
| 4609 | uint8_t num_persist_vars = 0; |
| 4610 | |
| 4611 | vm_MakeIdentity(&orient); |
| 4612 | |
| 4613 | if (type != OBJ_CAMERA && type != OBJ_DOOR) { |
| 4614 | // Get checksum |
| 4615 | checksum = MultiGetUint(data, &count); |
| 4616 | } |
| 4617 | |
| 4618 | if (type != OBJ_POWERUP && type != OBJ_DOOR) { |
| 4619 | multi_orientation multi_mat; |
| 4620 | |
| 4621 | // Get orientation |
| 4622 | memcpy(&multi_mat, &data[count], sizeof(multi_orientation)); |
| 4623 | MultiMatrixMakeEndianFriendly(&multi_mat); |
| 4624 | MultiExtractMatrix(&orient, &multi_mat); |
| 4625 | count += sizeof(multi_orientation); |
| 4626 | } |
| 4627 | |
| 4628 | int id; |
| 4629 | |
| 4630 | if (type != OBJ_CAMERA && type != OBJ_MARKER && type != OBJ_DOOR) { |
| 4631 | id = MultiMatchGeneric(checksum); |
| 4632 | |
| 4633 | if (id == -1) { |
| 4634 | mprintf(0, "Server data doesn't match client data!\n"); |
| 4635 | ASSERT(1); |
| 4636 | // Error ("Server data doesn't match client data!"); |
| 4637 | MultiMatchGeneric(checksum); |
| 4638 | } else { |
| 4639 | MULTI_ASSERT(Object_info[id].type == type, "DoJoinObjects type mismatch!"); // Get Jason! |
| 4640 | } |
| 4641 | } else if (type == OBJ_MARKER) { |
no test coverage detected