Does a water effect for this texture
| 1147 | } |
| 1148 | // Does a water effect for this texture |
| 1149 | void EvaluateWaterProcedural(int handle) { |
| 1150 | proc_struct *procedural = GameTextures[handle].procedural; |
| 1151 | if (procedural->memory_type != PROC_MEMORY_TYPE_WATER) |
| 1152 | AllocateMemoryForWaterProcedural(handle); |
| 1153 | |
| 1154 | int dest_bitmap = procedural->procedural_bitmap; |
| 1155 | for (int i = 0; i < procedural->num_static_elements; i++) { |
| 1156 | static_proc_element *proc = &procedural->static_proc_elements[i]; |
| 1157 | switch (proc->type) { |
| 1158 | case PROC_WATER_HEIGHT_BLOB: |
| 1159 | AddProcHeightBlob(proc, handle); |
| 1160 | break; |
| 1161 | case PROC_WATER_SINE_BLOB: |
| 1162 | AddProcSineBlob(proc, handle); |
| 1163 | break; |
| 1164 | case PROC_WATER_RAINDROPS: |
| 1165 | AddProcRaindrops(proc, handle); |
| 1166 | break; |
| 1167 | case PROC_WATER_BLOBDROPS: |
| 1168 | AddProcBlobdrops(proc, handle); |
| 1169 | break; |
| 1170 | default: |
| 1171 | break; |
| 1172 | } |
| 1173 | } |
| 1174 | if (EasterEgg) { |
| 1175 | if (Easter_egg_handle != -1) { |
| 1176 | uint16_t *src_data = bm_data(Easter_egg_handle, 0); |
| 1177 | int16_t *dest_data = (int16_t *)GameTextures[handle].procedural->proc1; |
| 1178 | int sw = bm_w(Easter_egg_handle, 0); |
| 1179 | int sh = bm_w(Easter_egg_handle, 0); |
| 1180 | int x1 = (PROC_SIZE / 2) - (sw / 2); |
| 1181 | int y1 = (PROC_SIZE / 2) - (sh / 2); |
| 1182 | // Make sure size is valid |
| 1183 | if (sw <= PROC_SIZE && sh <= PROC_SIZE) { |
| 1184 | int i, t; |
| 1185 | for (i = 0; i < sh; i++) { |
| 1186 | for (t = 0; t < sw; t++) { |
| 1187 | if (src_data[i * sw + t] & OPAQUE_FLAG) |
| 1188 | dest_data[((y1 + i) * PROC_SIZE) + t + x1] += 200; |
| 1189 | } |
| 1190 | } |
| 1191 | } |
| 1192 | } |
| 1193 | EasterEgg = 0; |
| 1194 | } |
| 1195 | // Calculate the water on the current texture |
| 1196 | if (!procedural->light) |
| 1197 | DrawWaterNoLight(handle); |
| 1198 | else |
| 1199 | DrawWaterWithLight(handle, procedural->light - 1); |
| 1200 | int thickness = procedural->thickness; |
| 1201 | if (procedural->osc_time > 0) { |
| 1202 | int start = procedural->osc_value; |
| 1203 | int end = procedural->thickness; |
| 1204 | if (start > end) { |
| 1205 | int t = start; |
| 1206 | start = end; |
no test coverage detected