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

Function MultiDoRenewPlayer

Descent3/multi.cpp:4772–4803  ·  view source on GitHub ↗

A player is coming back from the dead...restore his ship!

Source from the content-addressed store, hash-verified

4770
4771// A player is coming back from the dead...restore his ship!
4772void MultiDoRenewPlayer(uint8_t *data) {
4773 int count = 0;
4774 bool add_guidebot = false;
4775
4776 SKIP_HEADER(data, &count);
4777 uint8_t slot = MultiGetByte(data, &count);
4778 int start_slot = MultiGetShort(data, &count);
4779
4780 if (MultiGetByte(data, &count)) {
4781 add_guidebot = true;
4782 }
4783
4784 EndPlayerDeath(slot);
4785
4786 PlayerMoveToStartPos(slot, start_slot);
4787 MultiAnnounceEffect(&Objects[Players[slot].objnum], Objects[Players[slot].objnum].size * 5, 1.0);
4788
4789 // Make him invul for 2 seconds
4790 MakePlayerInvulnerable(slot, 2.0);
4791
4792 // add guidebot if needed
4793 if (add_guidebot) {
4794 mprintf(0, "MULTI: Adding guidebot to respawned player (%s)\n", Players[slot].callsign);
4795 if (!Players[slot].inventory.CheckItem(OBJ_ROBOT, ROBOT_GUIDEBOT))
4796 Players[slot].inventory.Add(OBJ_ROBOT, ROBOT_GUIDEBOT);
4797 }
4798
4799 // Update player position in demo
4800 if (Demo_flags == DF_RECORDING) {
4801 DemoWriteChangedObj(&Objects[Players[slot].objnum]);
4802 }
4803}
4804
4805// Tell everyone that a player is coming back from the dead
4806void MultiSendRenewPlayer(int slot) {

Callers 2

MultiSendRenewPlayerFunction · 0.85
MultiProcessDataFunction · 0.85

Calls 10

SKIP_HEADERFunction · 0.85
MultiGetByteFunction · 0.85
MultiGetShortFunction · 0.85
EndPlayerDeathFunction · 0.85
PlayerMoveToStartPosFunction · 0.85
MultiAnnounceEffectFunction · 0.85
MakePlayerInvulnerableFunction · 0.85
DemoWriteChangedObjFunction · 0.85
CheckItemMethod · 0.80
AddMethod · 0.45

Tested by

no test coverage detected