Server is telling us to apply damage to a player
| 5960 | |
| 5961 | // Server is telling us to apply damage to a player |
| 5962 | void MultiDoAdditionalDamage(uint8_t *data) { |
| 5963 | int count = 0; |
| 5964 | |
| 5965 | MULTI_ASSERT_NOMESSAGE(Netgame.local_role == LR_CLIENT); |
| 5966 | |
| 5967 | // mprintf(0,"Got additional damage packet!\n"); |
| 5968 | |
| 5969 | SKIP_HEADER(data, &count); |
| 5970 | |
| 5971 | uint8_t slot = MultiGetByte(data, &count); |
| 5972 | uint8_t type = MultiGetByte(data, &count); |
| 5973 | float amount = MultiGetFloat(data, &count); |
| 5974 | |
| 5975 | if (amount < 0) // add to shields |
| 5976 | { |
| 5977 | Objects[Players[slot].objnum].shields += (-amount); |
| 5978 | if (Objects[Players[slot].objnum].shields > MAX_SHIELDS) |
| 5979 | Objects[Players[slot].objnum].shields = MAX_SHIELDS; |
| 5980 | } else // take damage |
| 5981 | { |
| 5982 | ApplyDamageToPlayer(&Objects[Players[slot].objnum], NULL, type, amount, 1); |
| 5983 | } |
| 5984 | } |
| 5985 | |
| 5986 | // Asks the server for shields based on frametime "amount" x the type of shields requested |
| 5987 | void MultiSendRequestShields(int type, float amount) { |
no test coverage detected