MCPcopy Create free account
hub / github.com/DescentDevelopers/Descent3 / MultiDoRobotDamage

Function MultiDoRobotDamage

Descent3/multi.cpp:6844–6871  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6842}
6843
6844void MultiDoRobotDamage(uint8_t *data) {
6845 int count = 0;
6846 float damage;
6847 int weaponid;
6848 uint16_t hit_objnum, killer_objnum;
6849
6850 MULTI_ASSERT_NOMESSAGE(Netgame.local_role != LR_SERVER);
6851 SKIP_HEADER(data, &count);
6852 hit_objnum = Server_object_list[MultiGetUshort(data, &count)];
6853 killer_objnum = Server_object_list[MultiGetUshort(data, &count)];
6854
6855 if (hit_objnum == 65535 || killer_objnum == 65535 || !(Objects[hit_objnum].flags & OF_SERVER_OBJECT) ||
6856 !(Objects[killer_objnum].flags & OF_SERVER_OBJECT)) {
6857 mprintf(0, "Bad hit_objnum(%d) or killer_objnum(%d) in MultiDoRobotDamage()\n", hit_objnum, killer_objnum);
6858 // Int3(); // Get Jason, bad object number
6859 return;
6860 }
6861
6862 damage = MultiGetFloat(data, &count);
6863 weaponid = MultiGetInt(data, &count);
6864 if ((!((Objects[hit_objnum].flags & OF_DYING) || (Objects[hit_objnum].flags & OF_DEAD))) &&
6865 Objects[hit_objnum].type != 255)
6866 if ((!((Objects[killer_objnum].flags & OF_DYING) || (Objects[killer_objnum].flags & OF_DEAD))) &&
6867 Objects[killer_objnum].type != 255) {
6868 // The damage type doesn't matter on the client side (only server side) -- so, this one is bogus
6869 ApplyDamageToGeneric(&Objects[hit_objnum], &Objects[killer_objnum], GD_PHYSICS, damage, 1, weaponid);
6870 }
6871}
6872
6873void MultiAddObjAnimUpdate(int objnum) {
6874 MULTI_ASSERT_NOMESSAGE(Netgame.local_role == LR_SERVER);

Callers 1

MultiProcessDataFunction · 0.85

Calls 5

SKIP_HEADERFunction · 0.85
MultiGetUshortFunction · 0.85
MultiGetFloatFunction · 0.85
MultiGetIntFunction · 0.85
ApplyDamageToGenericFunction · 0.85

Tested by

no test coverage detected