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

Function ComputeRoomPulseLight

Descent3/render.cpp:2369–2396  ·  view source on GitHub ↗

Figures out a scalar value to apply to all vertices in the room

Source from the content-addressed store, hash-verified

2367
2368// Figures out a scalar value to apply to all vertices in the room
2369void ComputeRoomPulseLight(room *rp) {
2370 if (rp->pulse_time == 0 || In_editor_mode)
2371 Room_light_val = 1.0;
2372 else {
2373 float ptime = rp->pulse_time * WALL_PULSE_INCREMENT;
2374 float add_time = rp->pulse_offset * WALL_PULSE_INCREMENT;
2375
2376 int int_time = (int)((Gametime + add_time) / (ptime * 2));
2377 float left_time = (Gametime + add_time) - (int_time * ptime * 2);
2378 float norm_time = left_time / (ptime);
2379 if (norm_time > 1)
2380 Room_light_val = 1 - (norm_time - 1.0);
2381 else
2382 Room_light_val = norm_time;
2383 }
2384 if (!In_editor_mode) {
2385 if (rp->flags & RF_STROBE) {
2386 int val = (Gametime * 10) + (rp - Rooms);
2387 if (val % 2)
2388 Room_light_val = 0;
2389 }
2390 if (rp->flags & RF_FLICKER) {
2391 ps_srand((Gametime * 1000) + (rp - Rooms));
2392 if (ps_rand() % 2)
2393 Room_light_val = 0;
2394 }
2395 }
2396}
2397
2398
2399#define CORONA_DIST_CUTOFF 5.0f

Callers 3

RenderSingleLightGlowFunction · 0.85
RenderRoomFunction · 0.85
GetRoomDynamicScalarFunction · 0.85

Calls 2

ps_srandFunction · 0.85
ps_randFunction · 0.85

Tested by

no test coverage detected