Returns an index into the Dynamic_lightmaps array. Index returned is marked as unused
| 191 | |
| 192 | // Returns an index into the Dynamic_lightmaps array. Index returned is marked as unused |
| 193 | int GetFreeDynamicLightmap(int w, int h) { |
| 194 | int total = w * h * 2; |
| 195 | |
| 196 | if (Num_dynamic_lightmaps == MAX_DYNAMIC_LIGHTMAPS) |
| 197 | return -1; |
| 198 | |
| 199 | if (total + Cur_dynamic_mem_ptr > DYNAMIC_LIGHTMAP_MEMORY) { |
| 200 | mprintf(0, "Ran out of lightmap memory (%d)\n", DYNAMIC_LIGHTMAP_MEMORY); |
| 201 | return -1; |
| 202 | } |
| 203 | |
| 204 | int n = Num_dynamic_lightmaps++; |
| 205 | ASSERT(Dynamic_lightmaps[n].used == 0); |
| 206 | |
| 207 | Dynamic_lightmaps[n].used = 1; |
| 208 | Dynamic_lightmaps[n].mem_ptr = &Dynamic_lightmap_memory[Cur_dynamic_mem_ptr / 2]; |
| 209 | ASSERT(Dynamic_lightmaps[n].mem_ptr); |
| 210 | |
| 211 | Cur_dynamic_mem_ptr += total; |
| 212 | |
| 213 | return n; |
| 214 | } |
| 215 | |
| 216 | // Makes all the edges of dynamic lighting blend into the body of the lightmap |
| 217 | void BlendLightingEdges(lightmap_info *lmi_ptr) { |
no outgoing calls
no test coverage detected