… | |
… | |
86 | |
86 | |
87 | los_info &l = los[x][y]; |
87 | los_info &l = los[x][y]; |
88 | |
88 | |
89 | l.flags |= flags; |
89 | l.flags |= flags; |
90 | |
90 | |
91 | if (expect_false (l.flags & FLG_QUEUED)) |
91 | if (ecb_expect_false (l.flags & FLG_QUEUED)) |
92 | return; |
92 | return; |
93 | |
93 | |
94 | l.flags |= FLG_QUEUED; |
94 | l.flags |= FLG_QUEUED; |
95 | |
95 | |
96 | queue[q1].x = dx; |
96 | queue[q1].x = dx; |
… | |
… | |
159 | sint8 x = LOS_X0 + dx; |
159 | sint8 x = LOS_X0 + dx; |
160 | sint8 y = LOS_Y0 + dy; |
160 | sint8 y = LOS_Y0 + dy; |
161 | |
161 | |
162 | los_info &l = los[x][y]; |
162 | los_info &l = los[x][y]; |
163 | |
163 | |
164 | if (expect_true (l.flags & (FLG_XI | FLG_YI))) |
164 | if (ecb_expect_true (l.flags & (FLG_XI | FLG_YI))) |
165 | { |
165 | { |
166 | l.culled = 1; |
166 | l.culled = 1; |
167 | l.xo = l.yo = l.xe = l.ye = 0; |
167 | l.xo = l.yo = l.xe = l.ye = 0; |
168 | |
168 | |
169 | // check contributing spaces, first horizontal |
169 | // check contributing spaces, first horizontal |
170 | if (expect_true (l.flags & FLG_XI)) |
170 | if (ecb_expect_true (l.flags & FLG_XI)) |
171 | { |
171 | { |
172 | los_info *xi = &los[x - sign (dx)][y]; |
172 | los_info *xi = &los[x - sign (dx)][y]; |
173 | |
173 | |
174 | // don't cull unless obscured |
174 | // don't cull unless obscured |
175 | l.culled &= !xi->visible; |
175 | l.culled &= !xi->visible; |
176 | |
176 | |
177 | /* merge input space */ |
177 | /* merge input space */ |
178 | if (expect_false (xi->xo || xi->yo)) |
178 | if (ecb_expect_false (xi->xo || xi->yo)) |
179 | { |
179 | { |
180 | // The X input can provide two main pieces of information: |
180 | // The X input can provide two main pieces of information: |
181 | // 1. Progressive X obscurity. |
181 | // 1. Progressive X obscurity. |
182 | // 2. Recessive Y obscurity. |
182 | // 2. Recessive Y obscurity. |
183 | |
183 | |
… | |
… | |
200 | } |
200 | } |
201 | } |
201 | } |
202 | } |
202 | } |
203 | |
203 | |
204 | // check contributing spaces, last vertical, identical structure |
204 | // check contributing spaces, last vertical, identical structure |
205 | if (expect_true (l.flags & FLG_YI)) |
205 | if (ecb_expect_true (l.flags & FLG_YI)) |
206 | { |
206 | { |
207 | los_info *yi = &los[x][y - sign (dy)]; |
207 | los_info *yi = &los[x][y - sign (dy)]; |
208 | |
208 | |
209 | // don't cull unless obscured |
209 | // don't cull unless obscured |
210 | l.culled &= !yi->visible; |
210 | l.culled &= !yi->visible; |
211 | |
211 | |
212 | /* merge input space */ |
212 | /* merge input space */ |
213 | if (expect_false (yi->yo || yi->xo)) |
213 | if (ecb_expect_false (yi->yo || yi->xo)) |
214 | { |
214 | { |
215 | // The Y input can provide two main pieces of information: |
215 | // The Y input can provide two main pieces of information: |
216 | // 1. Progressive Y obscurity. |
216 | // 1. Progressive Y obscurity. |
217 | // 2. Recessive X obscurity. |
217 | // 2. Recessive X obscurity. |
218 | |
218 | |
… | |
… | |
399 | { |
399 | { |
400 | mapspace &ms = m->at (nx, ny); |
400 | mapspace &ms = m->at (nx, ny); |
401 | ms.update (); |
401 | ms.update (); |
402 | sint8 light = ms.light; |
402 | sint8 light = ms.light; |
403 | |
403 | |
404 | if (expect_false (light)) |
404 | if (ecb_expect_false (light)) |
405 | if (light < 0) |
405 | if (light < 0) |
406 | pass2 = 1; |
406 | pass2 = 1; |
407 | else |
407 | else |
408 | { |
408 | { |
409 | light = clamp (light + bonus, 0, MAX_LIGHT_RADIUS); |
409 | light = clamp (light + bonus, 0, MAX_LIGHT_RADIUS); |
… | |
… | |
441 | { |
441 | { |
442 | mapspace &ms = m->at (nx, ny); |
442 | mapspace &ms = m->at (nx, ny); |
443 | ms.update (); |
443 | ms.update (); |
444 | sint8 light = ms.light; |
444 | sint8 light = ms.light; |
445 | |
445 | |
446 | if (expect_false (light < 0)) |
446 | if (ecb_expect_false (light < 0)) |
447 | { |
447 | { |
448 | light = clamp (light - bonus, 0, MAX_DARKNESS); |
448 | light = clamp (light - bonus, 0, MAX_DARKNESS); |
449 | apply_light<los_darken> (pl, dx - pl->viewpoint->x, dy - pl->viewpoint->y, -light, light_atten [light + MAX_LIGHT_RADIUS]); |
449 | apply_light<los_darken> (pl, dx - pl->viewpoint->x, dy - pl->viewpoint->y, -light, light_atten [light + MAX_LIGHT_RADIUS]); |
450 | } |
450 | } |
451 | } |
451 | } |