| 1025 | } |
| 1026 | |
| 1027 | void UpdateSingleTerrainLightmap(int which) { |
| 1028 | int w = lm_w(TerrainLightmaps[which]); |
| 1029 | int i, t; |
| 1030 | |
| 1031 | GameLightmaps[TerrainLightmaps[which]].flags |= LF_CHANGED; |
| 1032 | |
| 1033 | int sx = (which % 2) * 128; |
| 1034 | int sz = (which / 2) * 128; |
| 1035 | |
| 1036 | for (i = sz; i < sz + 128; i++) { |
| 1037 | for (t = sx; t < sx + 128; t++) { |
| 1038 | int tseg = i * TERRAIN_WIDTH + t; |
| 1039 | terrain_segment *tp = &Terrain_seg[tseg]; |
| 1040 | |
| 1041 | uint16_t color = GR_RGB16(tp->r, tp->g, tp->b); |
| 1042 | uint16_t *data = lm_data(TerrainLightmaps[which]); |
| 1043 | |
| 1044 | int x = t % 128; |
| 1045 | int y = 127 - (i % 128); |
| 1046 | |
| 1047 | data[y * w + x] = OPAQUE_FLAG | color; |
| 1048 | } |
| 1049 | } |
| 1050 | } |
| 1051 | |
| 1052 | // Generates lightmaps based on the info given by the .light field of each Terrain_seg |
| 1053 | void UpdateTerrainLightmaps() { |
no test coverage detected