- /* TODO: append to other existing meshgroups for detail objects */
- cell->mgrp = wallgeom;
- cell->num_mgrp = 1;
-#endif
- return 0;
-}
-
-int gen_level_geom(struct level *lvl)
-{
- int i, j;
- struct cell *cell;
+ *rot = 0;
+
+ switch(adj) {
+ case 0:
+ case 0757:
+ /* really we'd need a separate tile type for "all neighbors solid", but we
+ * probably never going to need that in practice, so fuck it.
+ */
+ return TILE_OPEN;
+
+ case 0745:
+ case 0645:
+ case 0741:
+ case 0641:
+ return TILE_CORNER;
+
+ case 0744:
+ case 0644:
+ case 0740:
+ case 0640:
+ return TILE_OPENCORNER;
+
+ case 0715:
+ case 0315:
+ case 0714:
+ case 0314:
+ *rot = 1;
+ return TILE_CORNER;
+
+ case 0711:
+ case 0311:
+ case 0710:
+ case 0310:
+ *rot = 1;
+ return TILE_OPENCORNER;
+
+ case 0547:
+ case 0147:
+ case 0546:
+ case 0146:
+ *rot = 3;
+ return TILE_CORNER;
+
+ case 0447:
+ case 0047:
+ case 0446:
+ case 0046:
+ *rot = 3;
+ return TILE_OPENCORNER;
+
+ case 0517:
+ case 0417:
+ case 0513:
+ case 0413:
+ *rot = 2;
+ return TILE_CORNER;
+
+ case 0117:
+ case 0017:
+ case 0113:
+ case 0013:
+ *rot = 2;
+ return TILE_OPENCORNER;
+
+ case 0507: /* N tee */
+ *rot = 3;
+ return TILE_TEE;
+ case 0515: /* W tee */
+ *rot = 2;
+ return TILE_TEE;
+ case 0705: /* S tee */
+ *rot = 1;
+ return TILE_TEE;
+ case 0545: /* E tee */
+ return TILE_TEE;
+
+ case 0505: /* cross */
+ return TILE_CROSS;
+
+ case 0404: /* E str2open */
+ return TILE_STR2OPEN;
+ case 0005: /* N str2open */
+ *rot = 1;
+ return TILE_STR2OPEN;
+ case 0101: /* W str2open */
+ *rot = 2;
+ return TILE_STR2OPEN;
+ case 0500: /* S str2open */
+ *rot = 3;
+ return TILE_STR2OPEN;
+
+ default:
+ if((adj & 0222) == 0200) {
+ return TILE_STROPEN;
+ }
+ if((adj & 0222) == 0002) {
+ *rot = 2;
+ return TILE_STROPEN;
+ }
+ if((adj & 0070) == 0040) {
+ *rot = 3;
+ return TILE_STROPEN;
+ }
+ if((adj & 0070) == 0010) {
+ *rot = 1;
+ return TILE_STROPEN;
+ }