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

Function CopySqueezeBodyAndEdges

editor/editor_lighting.cpp:119–169  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

117}
118
119void CopySqueezeBodyAndEdges(uint16_t *dest_data, uint16_t *src_data, int w, int h, int dest_x, int dest_y) {
120 int i, t;
121
122 ASSERT(w + dest_x <= 126);
123 ASSERT(h + dest_y <= 126);
124 ASSERT(dest_x >= 0 && dest_y >= 0);
125
126 // First copy the main body
127 for (i = 0; i < h; i++) {
128 for (t = 0; t < w; t++) {
129 dest_data[((dest_y + 1 + i) * 128) + (dest_x + 1 + t)] = src_data[(w * i) + t];
130 Lightmap_mask[((dest_y + i + 1) * 128) + dest_x + 1 + t] = 1;
131 }
132 }
133
134 // Now copy the edges
135 // Left edge
136 for (i = 0; i < h; i++) {
137 dest_data[((dest_y + 1 + i) * 128) + (dest_x + 0)] = src_data[(w * i) + 0];
138 Lightmap_mask[((dest_y + i + 1) * 128) + dest_x + 0] = 1;
139 }
140 // Right edge
141 for (i = 0; i < h; i++) {
142 dest_data[((dest_y + 1 + i) * 128) + (dest_x + w + 1)] = src_data[(w * i) + (w - 1)];
143 Lightmap_mask[((dest_y + i + 1) * 128) + dest_x + w + 1] = 1;
144 }
145 // Top edge
146 for (i = 0; i < w; i++) {
147 dest_data[(dest_y * 128) + (dest_x + i + 1)] = src_data[i];
148 Lightmap_mask[(dest_y * 128) + (dest_x + i + 1)] = 1;
149 }
150 // Bottom edge
151 for (i = 0; i < w; i++) {
152 dest_data[((dest_y + 1 + h) * 128) + (dest_x + i + 1)] = src_data[(w * (h - 1)) + i];
153 Lightmap_mask[((dest_y + 1 + h) * 128) + (dest_x + i + 1)] = 1;
154 }
155
156 // Now copy the corners
157 // Upper left
158 dest_data[(dest_y * 128) + (dest_x)] = src_data[0];
159 Lightmap_mask[(dest_y * 128) + (dest_x)] = 1;
160 // Upper right
161 dest_data[(dest_y * 128) + (dest_x + w + 1)] = src_data[w - 1];
162 Lightmap_mask[(dest_y * 128) + (dest_x + w + 1)] = 1;
163 // Lower left
164 dest_data[((dest_y + h + 1) * 128) + (dest_x)] = src_data[w * (h - 1)];
165 Lightmap_mask[((dest_y + h + 1) * 128) + (dest_x)] = 1;
166 // Lower right
167 dest_data[((dest_y + h + 1) * 128) + (dest_x + w + 1)] = src_data[(w * (h - 1)) + (w - 1)];
168 Lightmap_mask[((dest_y + h + 1) * 128) + (dest_x + w + 1)] = 1;
169}
170
171void CopySqueezeDataForRooms(int roomnum, int facenum, uint16_t *dest_data, int dest_x, int dest_y) {
172 room *rp = &Rooms[roomnum];

Callers 2

CopySqueezeDataForRoomsFunction · 0.85
CopySqueezeDataForObjectFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected