| 1143 | } |
| 1144 | |
| 1145 | uchar *texconfig_paste(void *_s, uchar *usedslots) // create mapping table to translate pasted geometry to this maps texture list - add any missing textures |
| 1146 | { |
| 1147 | vector<Slot> *s = (vector<Slot> *)_s; |
| 1148 | static uchar res[256]; |
| 1149 | loopi(256) res[i] = i; |
| 1150 | loopi(256) if(usedslots[i] && s->inrange(i)) |
| 1151 | { |
| 1152 | Slot &os = (*s)[i]; |
| 1153 | bool found = false; |
| 1154 | loopvj(slots) |
| 1155 | { |
| 1156 | if(slots[j].scale == os.scale && !strcmp(slots[j].name, os.name)) |
| 1157 | { |
| 1158 | res[i] = j; |
| 1159 | found = true; |
| 1160 | break; |
| 1161 | } |
| 1162 | } |
| 1163 | if(!found) |
| 1164 | { |
| 1165 | if(slots.length() < 255) |
| 1166 | { |
| 1167 | res[i] = slots.length(); |
| 1168 | _texture(slots.add(), &os.scale, os.name); |
| 1169 | conoutf("added texture \"%s\" (scale %.7g) in slot #%d", os.name, os.scale, res[i]); |
| 1170 | if(!(hdr.flags & MHF_AUTOMAPCONFIG)) automapconfig(); // make sure, the new texture slots will be saved with the map |
| 1171 | } |
| 1172 | else conoutf("\f3failed to add texture \"%s\" (scale %.7g): no texture slot available", os.name, os.scale); |
| 1173 | } |
| 1174 | } |
| 1175 | return res; |
| 1176 | } |
| 1177 | |
| 1178 | struct temptexslot { Slot s; vector<int> oldslot; bool used; }; |
| 1179 | |