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

Function DoRoomChangeFrame

Descent3/room.cpp:1290–1338  ·  view source on GitHub ↗

Does whatever fading/changing of room stuff that needs to be done this frame

Source from the content-addressed store, hash-verified

1288
1289// Does whatever fading/changing of room stuff that needs to be done this frame
1290void DoRoomChangeFrame() {
1291 int i;
1292 for (i = 0; i < MAX_ROOM_CHANGES; i++) {
1293 if (!Room_changes[i].used)
1294 continue;
1295
1296 room *rp = &Rooms[Room_changes[i].roomnum];
1297
1298 float norm = (Gametime - Room_changes[i].start_time) / Room_changes[i].total_time;
1299
1300 if (norm > 1)
1301 norm = 1.0;
1302
1303 if (Room_changes[i].fog) {
1304
1305 vector scale_color =
1306 ((Room_changes[i].end_vector - Room_changes[i].start_vector) * norm) + Room_changes[i].start_vector;
1307 float scale_depth =
1308 ((Room_changes[i].end_depth - Room_changes[i].start_depth) * norm) + Room_changes[i].start_depth;
1309
1310 rp->flags |= RF_FOG;
1311 rp->room_change_flags |= RCF_CHANGING_WIND_FOG;
1312
1313 rp->fog_r = scale_color.x;
1314 rp->fog_g = scale_color.y;
1315 rp->fog_b = scale_color.z;
1316 rp->fog_depth = scale_depth;
1317 } else {
1318 vector scale_wind =
1319 ((Room_changes[i].end_vector - Room_changes[i].start_vector) * norm) + Room_changes[i].start_vector;
1320
1321 rp->room_change_flags |= RCF_CHANGING_WIND_FOG;
1322 rp->wind = scale_wind;
1323 }
1324
1325 // If this room is done changing, take it out of the list and mark it as changed
1326 if (norm >= 1.0) {
1327 Room_changes[i].used = 0;
1328 if (Room_changes[i].fog)
1329 rp->room_change_flags |= RCF_FOG;
1330 else
1331 rp->room_change_flags |= RCF_WIND;
1332
1333 rp->room_change_flags &= ~RCF_CHANGING_WIND_FOG;
1334
1335 continue;
1336 }
1337 }
1338}
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) {

Callers 1

GameDrawMainViewFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected