Extracts the multisafe function to be executed on the client machine
| 55 | bool Demo_call_ok = false; |
| 56 | // Extracts the multisafe function to be executed on the client machine |
| 57 | void MultiDoMSafeFunction(uint8_t *data) { |
| 58 | msafe_struct base_mstruct; |
| 59 | msafe_struct *mstruct = &base_mstruct; |
| 60 | int count = 0; |
| 61 | |
| 62 | SKIP_HEADER(data, &count); |
| 63 | uint8_t type = MultiGetUbyte(data, &count); |
| 64 | switch (type) { |
| 65 | case MSAFE_WEATHER_RAIN: |
| 66 | mstruct->state = MultiGetByte(data, &count); |
| 67 | mstruct->scalar = MultiGetFloat(data, &count); |
| 68 | break; |
| 69 | case MSAFE_WEATHER_SNOW: |
| 70 | mstruct->state = MultiGetByte(data, &count); |
| 71 | mstruct->scalar = MultiGetFloat(data, &count); |
| 72 | break; |
| 73 | case MSAFE_WEATHER_LIGHTNING: |
| 74 | mstruct->state = MultiGetByte(data, &count); |
| 75 | mstruct->randval = MultiGetUbyte(data, &count); |
| 76 | mstruct->scalar = MultiGetFloat(data, &count); |
| 77 | break; |
| 78 | case MSAFE_WEATHER_LIGHTNING_BOLT: |
| 79 | mstruct->roomnum = MultiGetInt(data, &count); |
| 80 | GET_AND_VERIFY_OBJECT(mstruct->objhandle); |
| 81 | |
| 82 | mstruct->pos.x = MultiGetFloat(data, &count); |
| 83 | mstruct->pos.y = MultiGetFloat(data, &count); |
| 84 | mstruct->pos.z = MultiGetFloat(data, &count); |
| 85 | |
| 86 | mstruct->lifetime = MultiGetFloat(data, &count); |
| 87 | |
| 88 | mstruct->pos2.x = MultiGetFloat(data, &count); |
| 89 | mstruct->pos2.y = MultiGetFloat(data, &count); |
| 90 | mstruct->pos2.z = MultiGetFloat(data, &count); |
| 91 | |
| 92 | char str[255]; |
| 93 | MultiGetString(str, data, &count); |
| 94 | mstruct->texnum = FindTextureName(str); |
| 95 | if (mstruct->texnum < 0) |
| 96 | mstruct->texnum = 0; |
| 97 | |
| 98 | mstruct->color = MultiGetUshort(data, &count); |
| 99 | mstruct->size = MultiGetByte(data, &count); |
| 100 | mstruct->state = MultiGetByte(data, &count); |
| 101 | mstruct->count = MultiGetByte(data, &count); |
| 102 | mstruct->interval = MultiGetFloat(data, &count); |
| 103 | mstruct->index = MultiGetByte(data, &count); |
| 104 | mstruct->flags = MultiGetByte(data, &count); |
| 105 | |
| 106 | if (mstruct->flags) { |
| 107 | mstruct->g1 = MultiGetUshort(data, &count); |
| 108 | mstruct->g2 = MultiGetUshort(data, &count); |
| 109 | } else { |
| 110 | GET_AND_VERIFY_OBJECT(mstruct->ithandle); |
| 111 | } |
| 112 | break; |
| 113 | case MSAFE_ROOM_TEXTURE: |
| 114 | mstruct->roomnum = MultiGetShort(data, &count); |
no test coverage detected