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

Function MultiDoObserverChange

Descent3/multi.cpp:6131–6160  ·  view source on GitHub ↗

Server is telling us about a player who is changing his observer mode

Source from the content-addressed store, hash-verified

6129
6130// Server is telling us about a player who is changing his observer mode
6131void MultiDoObserverChange(uint8_t *data) {
6132 int count = 0;
6133 int objnum = -1;
6134
6135 SKIP_HEADER(data, &count);
6136
6137 int slot = MultiGetByte(data, &count);
6138 uint8_t mode = MultiGetByte(data, &count);
6139 uint8_t on = MultiGetByte(data, &count);
6140 int restart_slot = MultiGetShort(data, &count);
6141 if (mode == OBSERVER_MODE_PIGGYBACK) {
6142 if (Netgame.local_role == LR_SERVER)
6143 objnum = MultiGetInt(data, &count);
6144 else {
6145 objnum = Server_object_list[MultiGetInt(data, &count)];
6146 MULTI_ASSERT_NOMESSAGE(objnum != 65535);
6147 }
6148 }
6149
6150 if (on)
6151 PlayerSwitchToObserver(slot, mode, objnum);
6152 else {
6153 Player_pos_fix[slot].active = true;
6154 Player_pos_fix[slot].expire_time = Gametime + PLAYER_POS_HACK_TIME;
6155 Player_pos_fix[slot].room = Players[restart_slot].start_roomnum;
6156 Player_pos_fix[slot].ignored_pos = 0;
6157 PlayerStopObserving(slot);
6158 PlayerMoveToStartPos(slot, restart_slot);
6159 }
6160}
6161
6162// Someone is asking us for permission to enter observer mode
6163void MultiDoRequestToObserve(uint8_t *data) {

Callers 2

MultiDoRequestToObserveFunction · 0.85
MultiProcessDataFunction · 0.85

Calls 7

SKIP_HEADERFunction · 0.85
MultiGetByteFunction · 0.85
MultiGetShortFunction · 0.85
MultiGetIntFunction · 0.85
PlayerSwitchToObserverFunction · 0.85
PlayerStopObservingFunction · 0.85
PlayerMoveToStartPosFunction · 0.85

Tested by

no test coverage detected