Given a handle, frees the lightmap memory and flags this lightmap as unused
| 98 | } |
| 99 | // Given a handle, frees the lightmap memory and flags this lightmap as unused |
| 100 | void lm_FreeLightmap(int handle) { |
| 101 | if (GameLightmaps[handle].used < 1) |
| 102 | return; |
| 103 | GameLightmaps[handle].used--; |
| 104 | if (GameLightmaps[handle].used == 0) { |
| 105 | if (GameLightmaps[handle].data != NULL) |
| 106 | mem_free(GameLightmaps[handle].data); |
| 107 | Lightmap_mem_used -= (GameLightmaps[handle].width * GameLightmaps[handle].height * 2); |
| 108 | |
| 109 | GameLightmaps[handle].data = NULL; |
| 110 | GameLightmaps[handle].cache_slot = -1; |
| 111 | |
| 112 | Free_lightmap_list[--Num_of_lightmaps] = handle; |
| 113 | } |
| 114 | } |
| 115 | // returns a lightmaps width else -1 if something is wrong |
| 116 | int lm_w(int handle) { |
| 117 | int w; |
no outgoing calls
no test coverage detected