MCPcopy Create free account
hub / github.com/assaultcube/AC / calclight

Function calclight

source/src/worldlight.cpp:179–217  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

177VARF(ambient, 0, 0, 0xFFFFFF, if(!noteditmode("ambient")) { hdr.ambient = ambient; calclight(); unsavededits++;});
178
179void calclight()
180{
181 if(editmode)
182 {
183 servsqr *servworld = createservworld(world, cubicsize);
184 calcmapdims(clmapdims, servworld, ssize);
185 delete[] servworld;
186 }
187 uchar r = (hdr.ambient>>16) & 0xFF, g = (hdr.ambient>>8) & 0xFF, b = hdr.ambient & 0xFF;
188 if(!r && !g)
189 {
190 if(!b) b = 10;
191 r = g = b;
192 }
193 else if(!maxtmus) r = g = b = max(max(r, g), b); // the old (white) light code, here for the few people with old video cards that don't support overbright
194 sqr *s = S(0,0);
195 loopirev(cubicsize)
196 {
197 s->r = r;
198 s->g = g;
199 s->b = b;
200 s++;
201 }
202
203 seedMT(ents.length() + hdr.maprevision); // static seed -> nothing random here
204
205 loopv(ents)
206 {
207 entity &e = ents[i];
208 if(e.type==LIGHT) calclightsource(e);
209 }
210
211 popMT(); // undo the static seedMT() from above
212
213 block bb = { clmapdims.x1 - 1, clmapdims.y1 - 1, clmapdims.xspan + 2, clmapdims.yspan + 2 };
214 postlightarea(bb);
215 setvar("fullbright", 0);
216 lastcalclight = totalmillis;
217}
218
219struct dlight
220{

Callers 14

entpropertyFunction · 0.85
delentFunction · 0.85
newentityFunction · 0.85
clearentsFunction · 0.85
deleteentityFunction · 0.85
editentityFunction · 0.85
scalelightsFunction · 0.85
empty_worldFunction · 0.85
mapmrproperFunction · 0.85
parsemessagesFunction · 0.85
worldlight.cppFile · 0.85
load_worldFunction · 0.85

Calls 8

createservworldFunction · 0.85
calcmapdimsFunction · 0.85
maxFunction · 0.85
seedMTFunction · 0.85
popMTFunction · 0.85
postlightareaFunction · 0.85
setvarFunction · 0.85
lengthMethod · 0.45

Tested by

no test coverage detected