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

Function MultiSendRenewPlayer

Descent3/multi.cpp:4806–4842  ·  view source on GitHub ↗

Tell everyone that a player is coming back from the dead

Source from the content-addressed store, hash-verified

4804
4805// Tell everyone that a player is coming back from the dead
4806void MultiSendRenewPlayer(int slot) {
4807 MULTI_ASSERT(Netgame.local_role == LR_SERVER, "Client in SendRenewPlayer!");
4808
4809 uint8_t data[MAX_GAME_DATA_SIZE];
4810 int count = 0;
4811 int size_offset;
4812
4813 size_offset = START_DATA(MP_RENEW_PLAYER, data, &count, 1);
4814 MultiAddByte(slot, data, &count);
4815
4816 // Get random start slot
4817 int start_slot = PlayerGetRandomStartPosition(slot);
4818 MultiAddShort(start_slot, data, &count);
4819
4820 Player_pos_fix[slot].active = true;
4821 Player_pos_fix[slot].expire_time = Gametime + PLAYER_POS_HACK_TIME;
4822 Player_pos_fix[slot].room = Players[start_slot].start_roomnum;
4823 Player_pos_fix[slot].ignored_pos = 0;
4824
4825 // check to see if they need to add a guidebot to the player's inventory
4826 if (Netgame.flags & NF_ALLOWGUIDEBOT) {
4827 if ((!Players[slot].inventory.CheckItem(OBJ_ROBOT, ROBOT_GUIDEBOT)) &&
4828 (ObjGet(Buddy_handle[slot])->type != OBJ_ROBOT)) {
4829 MultiAddByte(1, data, &count);
4830 } else {
4831 MultiAddByte(0, data, &count);
4832 }
4833 } else {
4834 MultiAddByte(0, data, &count);
4835 }
4836
4837 END_DATA(count, data, size_offset);
4838
4839 MultiSendReliablyToAllExcept(Player_num, data, count, NETSEQ_PLAYERS, false);
4840
4841 MultiDoRenewPlayer(data);
4842}
4843
4844// This player says he's done dying
4845void MultiDoEndPlayerDeath(uint8_t *data) {

Callers 1

MultiDoEndPlayerDeathFunction · 0.85

Calls 9

START_DATAFunction · 0.85
MultiAddByteFunction · 0.85
MultiAddShortFunction · 0.85
ObjGetFunction · 0.85
END_DATAFunction · 0.85
MultiDoRenewPlayerFunction · 0.85
CheckItemMethod · 0.80

Tested by

no test coverage detected