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

Function MultiDoWorldStates

Descent3/multi.cpp:4200–4555  ·  view source on GitHub ↗

Server is telling us the world state

Source from the content-addressed store, hash-verified

4198doorway *GetDoorwayFromObject(int door_obj_handle);
4199// Server is telling us the world state
4200void MultiDoWorldStates(uint8_t *data) {
4201 int count = 0;
4202 uint8_t world_type;
4203
4204 SKIP_HEADER(data, &count);
4205
4206 mprintf(0, "Got a world state packet!\n");
4207
4208 while ((world_type = MultiGetByte(data, &count)) != WS_END) {
4209 switch (world_type) {
4210 case WS_ROOM_WIND: {
4211 // Room wind
4212
4213 int16_t roomnum = MultiGetShort(data, &count);
4214 Rooms[roomnum].wind.x = MultiGetFloat(data, &count);
4215 Rooms[roomnum].wind.y = MultiGetFloat(data, &count);
4216 Rooms[roomnum].wind.z = MultiGetFloat(data, &count);
4217
4218 mprintf(0, "Got room wind packet! Room=%d wind=%f %f %f\n",
4219 roomnum,
4220 Rooms[roomnum].wind.x,
4221 Rooms[roomnum].wind.y,
4222 Rooms[roomnum].wind.z);
4223 break;
4224 }
4225 case WS_ROOM_FOG: {
4226 // Room wind
4227 int16_t roomnum = MultiGetShort(data, &count);
4228 Rooms[roomnum].fog_depth = MultiGetFloat(data, &count);
4229 Rooms[roomnum].fog_r = ((float)MultiGetUbyte(data, &count)) / 255.0;
4230 Rooms[roomnum].fog_g = ((float)MultiGetUbyte(data, &count)) / 255.0;
4231 Rooms[roomnum].fog_b = ((float)MultiGetUbyte(data, &count)) / 255.0;
4232 uint8_t state = MultiGetUbyte(data, &count);
4233 if (state)
4234 Rooms[roomnum].flags |= RF_FOG;
4235 else
4236 Rooms[roomnum].flags &= ~RF_FOG;
4237
4238 break;
4239 }
4240
4241 case WS_ROOM_LIGHTING: {
4242 // Room lighting
4243 uint8_t state;
4244 int16_t roomnum = MultiGetShort(data, &count);
4245 Rooms[roomnum].pulse_time = MultiGetUbyte(data, &count);
4246 Rooms[roomnum].pulse_offset = MultiGetUbyte(data, &count);
4247 state = MultiGetUbyte(data, &count);
4248 if (state)
4249 Rooms[roomnum].flags |= RF_FLICKER;
4250 else
4251 Rooms[roomnum].flags &= ~RF_FLICKER;
4252
4253 state = MultiGetUbyte(data, &count);
4254 if (state)
4255 Rooms[roomnum].flags |= RF_STROBE;
4256 else
4257 Rooms[roomnum].flags &= ~RF_STROBE;

Callers 1

MultiProcessDataFunction · 0.85

Calls 15

SKIP_HEADERFunction · 0.85
MultiGetByteFunction · 0.85
MultiGetShortFunction · 0.85
MultiGetFloatFunction · 0.85
MultiGetUbyteFunction · 0.85
MultiGetStringFunction · 0.85
ChangeRoomFaceTextureFunction · 0.85
FindTextureNameFunction · 0.85
BreakGlassFaceFunction · 0.85
MultiGetIntFunction · 0.85
MultiGetUshortFunction · 0.85
ObjGetFunction · 0.85

Tested by

no test coverage detected