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

Function SetRoomChangeOverTime

Descent3/room.cpp:1341–1378  ·  view source on GitHub ↗

Sets up a room to change its fog or wind over time

Source from the content-addressed store, hash-verified

1339
1340// Sets up a room to change its fog or wind over time
1341int SetRoomChangeOverTime(int roomnum, bool fog, vector *end, float depth_end, float time) {
1342 room *rp = &Rooms[roomnum];
1343 int index, i;
1344
1345 // First search to see if there is another with this same roomnum
1346
1347 int found = 0;
1348 for (i = 0; i < MAX_ROOM_CHANGES && !found; i++) {
1349 if (Room_changes[i].used && Room_changes[i].roomnum == roomnum && Room_changes[i].fog == fog) {
1350 found = 1;
1351 index = i;
1352 }
1353 }
1354
1355 if (!found) {
1356 index = AllocRoomChange();
1357 if (index < 0)
1358 return -1; // failed get free slot!
1359 }
1360
1361 Room_changes[index].roomnum = roomnum;
1362 Room_changes[index].fog = fog;
1363 Room_changes[index].end_vector = *end;
1364 Room_changes[index].start_time = Gametime;
1365 Room_changes[index].total_time = time;
1366 rp->room_change_flags |= RCF_CHANGING_WIND_FOG;
1367
1368 if (fog) {
1369 Room_changes[index].start_depth = rp->fog_depth;
1370 Room_changes[index].start_vector.x = rp->fog_r;
1371 Room_changes[index].start_vector.y = rp->fog_g;
1372 Room_changes[index].start_vector.z = rp->fog_b;
1373 Room_changes[index].end_depth = depth_end;
1374 } else
1375 Room_changes[index].start_vector = rp->wind;
1376
1377 return index;
1378}

Callers 1

msafe_CallFunctionFunction · 0.85

Calls 1

AllocRoomChangeFunction · 0.85

Tested by

no test coverage detected