Since John Carmack actually ocassionally posts on Hacker News this seems like a valid @JohnCarmack
If comprehended correctly, Half Life, Half Life 2, CounterStrike, and Portal are all using Carmack's code for “Quake” from 1996 and Romero's flickering presets from 1993 “DoomED”.
The lights themselves have 26 positions, a = 0 = OFF, and b-z = Various ON brightnesses.
This is where some of this starts getting a bit confusing.
In "world.qc" [1] the top comments note:
// Setup light animation tables. 'a' is total darkness, 'z' is maxbright.
However, "r_light.c" [2] the comment instead reads:
// light animations
// 'm' is normal light, 'a' is no light, 'z' is double bright
The first [1] sounds like b-z = 1-25 = 4%-100% brightness. The second sounds like 100% is at 'm' and then upward toward 200% at 'z'.
The code in [2] is also rather confusing with:
k = i % cl_lightstyle[j].length;
k = cl_lightstyle[j].map[k] - 'a';
k = k*22;
d_lightstylevalue[j] = k;
It looks like it's taking the frame you're on, mapping to a letter in the cl_lightstyle, subtracting the letters from each other using C's 'char' subtraction, so 'm' (13) - 'a' (1) = 12, multiplying by 22, so 'm' = 264, and then using that as a lookup into a scaling factor for the lightmap?
This is mostly a bunch of deduction since this is not even kind of a language I write in normally (QuakeC), with a bunch of odd features being used. Does this seem like what this code is actually doing? It seems like something must be wrong, cause 264 for "normal light" is not something you'd normally expect. Even the 'map' function usage is a little weird, since C usually does not have a 'map' function.
Expect it's hidden in the code somewhere and looks something like:
// Map function
void map(int *arr, int size, int (*func)(int)) {
for (int i = 0; i < size; i++) {
arr[i] = func(arr[i]);
}
}
Anybody with greater amounts of QuakeC or Quake modding experience (maybe Half Life ect...) able to comment on what this actually does?
Also, vaguely hillarious, everybody's favorite light is:
// 10 FLUORESCENT FLICKER
And the light constantly goes:
lightstyle(10, "mmamammmmammamamaaamammma");
The light is literally crying like a child. Maybe that explains some of the infantile FPS player behavior.
Since John Carmack actually ocassionally posts on Hacker News this seems like a valid @JohnCarmack
If comprehended correctly, Half Life, Half Life 2, CounterStrike, and Portal are all using Carmack's code for “Quake” from 1996 and Romero's flickering presets from 1993 “DoomED”.
The lights themselves have 26 positions, a = 0 = OFF, and b-z = Various ON brightnesses.
This is where some of this starts getting a bit confusing.
In "world.qc" [1] the top comments note:
However, "r_light.c" [2] the comment instead reads: The first [1] sounds like b-z = 1-25 = 4%-100% brightness. The second sounds like 100% is at 'm' and then upward toward 200% at 'z'.The code in [2] is also rather confusing with:
and later on: It looks like it's taking the frame you're on, mapping to a letter in the cl_lightstyle, subtracting the letters from each other using C's 'char' subtraction, so 'm' (13) - 'a' (1) = 12, multiplying by 22, so 'm' = 264, and then using that as a lookup into a scaling factor for the lightmap?This is mostly a bunch of deduction since this is not even kind of a language I write in normally (QuakeC), with a bunch of odd features being used. Does this seem like what this code is actually doing? It seems like something must be wrong, cause 264 for "normal light" is not something you'd normally expect. Even the 'map' function usage is a little weird, since C usually does not have a 'map' function.
Expect it's hidden in the code somewhere and looks something like:
Anybody with greater amounts of QuakeC or Quake modding experience (maybe Half Life ect...) able to comment on what this actually does?Also, vaguely hillarious, everybody's favorite light is:
And the light constantly goes: The light is literally crying like a child. Maybe that explains some of the infantile FPS player behavior.[1] https://github.com/id-Software/Quake/blob/bf4ac424ce754894ac...
[2] https://github.com/id-Software/Quake/blob/bf4ac424ce754894ac...