MCPcopy Create free account
hub / github.com/DescentDevelopers/Descent3 / DrawWaterNoLight

Function DrawWaterNoLight

Descent3/procedurals.cpp:932–961  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

930 }
931}
932void DrawWaterNoLight(int handle) {
933 int dx, dy;
934 int x, y;
935 int offset = 0;
936 proc_struct *procedural = GameTextures[handle].procedural;
937 int dest_bitmap = procedural->procedural_bitmap;
938 uint16_t *dest_data = (uint16_t *)bm_data(dest_bitmap, 0);
939 uint16_t *src_data = (uint16_t *)bm_data(GameTextures[handle].bm_handle, 0);
940 int16_t *ptr = (int16_t *)procedural->proc1;
941 for (y = 0; y < PROC_SIZE; y++) {
942 for (x = 0; x < PROC_SIZE; x++, offset++) {
943 if (x == PROC_SIZE - 1)
944 dx = ptr[offset] - ptr[offset - (PROC_SIZE - 1)];
945 else
946 dx = ptr[offset] - ptr[offset + 1];
947 if (y == PROC_SIZE - 1)
948 dy = ptr[offset] - ptr[offset - ((PROC_SIZE - 1) * PROC_SIZE)];
949 else
950 dy = ptr[offset] - ptr[offset + PROC_SIZE];
951 if (dy < 0)
952 dy = 0;
953 if (dx < 0)
954 dx = 0;
955
956 int yoffset = (y + (dy >> 3)) % PROC_SIZE;
957 int xoffset = (x + (dx >> 3)) % PROC_SIZE;
958 dest_data[offset] = src_data[yoffset * PROC_SIZE + xoffset];
959 }
960 }
961}
962void DrawWaterWithLight(int handle, int lightval) {
963 int dx, dy;
964 int x, y;

Callers 1

EvaluateWaterProceduralFunction · 0.85

Calls 1

bm_dataFunction · 0.85

Tested by

no test coverage detected